mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 07:17:55 +03:00
tests: fix run-tests.py diff output with Python 3
Summary: The migration to Python 3 broke the unified diff code because difflib expected the paths to also be bytes. Reviewed By: quark-zju Differential Revision: D28758876 fbshipit-source-id: 367ef237594d2908377cd8b81def364b77ee02e2
This commit is contained in:
parent
977e8b160b
commit
38be9c8f05
@ -821,7 +821,10 @@ def getdiff(expected, output, ref, err):
|
||||
# output directly.
|
||||
return servefail, output
|
||||
for line in _unified_diff(
|
||||
expected, output, os.path.basename(ref), os.path.basename(err)
|
||||
expected,
|
||||
output,
|
||||
_bytespath(os.path.basename(ref)),
|
||||
_bytespath(os.path.basename(err)),
|
||||
):
|
||||
if line.startswith(b"+++") or line.startswith(b"---"):
|
||||
line = line.replace(b"\\", b"/")
|
||||
@ -1154,9 +1157,7 @@ class Test(unittest.TestCase):
|
||||
|
||||
if self._watchman:
|
||||
shortname = hashlib.sha1("%s" % name).hexdigest()[:6]
|
||||
self._watchmandir = os.path.join(
|
||||
self._threadtmp, "%s.watchman" % shortname
|
||||
)
|
||||
self._watchmandir = os.path.join(self._threadtmp, "%s.watchman" % shortname)
|
||||
os.mkdir(self._watchmandir)
|
||||
cfgfile = os.path.join(self._watchmandir, "config.json")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user