Mercurial > hg-stable
changeset 45010:62bdb288c449
tests: add hghave rule 'setprocname' to check if osutil.setprocname and use it
setprocname is not present when we build a pure version. This leads to output
changes in test-chg.t
This should make test suite green on Python 2 pure build with chg.
Differential Revision: https://phab.mercurial-scm.org/D8638
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Wed, 17 Jun 2020 17:46:30 +0530 |
parents | 7af5c1f5b3a0 |
children | 65d19d9c8e76 |
files | tests/hghave.py tests/test-chg.t |
diffstat | 2 files changed, 15 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/hghave.py Fri Jun 19 20:42:14 2020 +0530 +++ b/tests/hghave.py Wed Jun 17 17:46:30 2020 +0530 @@ -683,6 +683,17 @@ return True +@check("setprocname", "whether osutil.setprocname is available or not") +def has_setprocname(): + try: + from mercurial.utils import procutil + + procutil.setprocname + return True + except AttributeError: + return False + + @check("test-repo", "running tests from repository") def has_test_repo(): t = os.environ["TESTDIR"]
--- a/tests/test-chg.t Fri Jun 19 20:42:14 2020 +0530 +++ b/tests/test-chg.t Wed Jun 17 17:46:30 2020 +0530 @@ -229,13 +229,13 @@ server.log.1 print only the last 10 lines, since we aren't sure how many records are -preserved (since setprocname isn't available on py3, the 10th-most-recent line -is different when using py3): +preserved (since setprocname isn't available on py3 and pure version, +the 10th-most-recent line is different when using py3): $ cat log/server.log.1 log/server.log | tail -10 | filterlog - YYYY/MM/DD HH:MM:SS (PID)> confighash = ... mtimehash = ... (py3 !) + YYYY/MM/DD HH:MM:SS (PID)> confighash = ... mtimehash = ... (no-setprocname !) YYYY/MM/DD HH:MM:SS (PID)> forked worker process (pid=...) - YYYY/MM/DD HH:MM:SS (PID)> setprocname: ... (no-py3 !) + YYYY/MM/DD HH:MM:SS (PID)> setprocname: ... (setprocname !) YYYY/MM/DD HH:MM:SS (PID)> received fds: ... YYYY/MM/DD HH:MM:SS (PID)> chdir to '$TESTTMP/extreload' YYYY/MM/DD HH:MM:SS (PID)> setumask 18