Mercurial > hg
comparison tests/run-tests.py @ 48859:f928dec9add7
tests: unconditionalize _unified_diff
Now that we're Python 3 only we can make this logic simpler.
Differential Revision: https://phab.mercurial-scm.org/D12237
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sun, 20 Feb 2022 13:20:33 -0700 |
parents | 9d01ab54df3f |
children | 4cea98b32d95 |
comparison
equal
deleted
inserted
replaced
48858:9d01ab54df3f | 48859:f928dec9add7 |
---|---|
50 import collections | 50 import collections |
51 import contextlib | 51 import contextlib |
52 import difflib | 52 import difflib |
53 import distutils.version as version | 53 import distutils.version as version |
54 import errno | 54 import errno |
55 import functools | |
55 import json | 56 import json |
56 import multiprocessing | 57 import multiprocessing |
57 import os | 58 import os |
58 import platform | 59 import platform |
59 import random | 60 import random |
877 os.chmod(p, os.stat(p).st_mode & 0o777 | 0o700) # chmod u+rwx | 878 os.chmod(p, os.stat(p).st_mode & 0o777 | 0o700) # chmod u+rwx |
878 except OSError: | 879 except OSError: |
879 pass | 880 pass |
880 | 881 |
881 | 882 |
882 _unified_diff = difflib.unified_diff | 883 _unified_diff = functools.partial(difflib.diff_bytes, difflib.unified_diff) |
883 if PYTHON3: | |
884 import functools | |
885 | |
886 _unified_diff = functools.partial(difflib.diff_bytes, difflib.unified_diff) | |
887 | 884 |
888 | 885 |
889 def getdiff(expected, output, ref, err): | 886 def getdiff(expected, output, ref, err): |
890 servefail = False | 887 servefail = False |
891 lines = [] | 888 lines = [] |