py3: string normalization and I/O tweaks in test-lfs.t
authorGregory Szorc <gregory.szorc@gmail.com>
Fri, 17 Jan 2020 22:24:27 -0800
changeset 44111 2928d5af6281
parent 44110 6ae32c12b578
child 44112 97cc270c3ecc
py3: string normalization and I/O tweaks in test-lfs.t The print was inserting b'' on Python 3. In addition, since we weren't writing to the ui instance (which isn't readily available in this function), output order could get mixed up. We add some pycompat casts and a stdout flush to make the test happy on all Python versions. Differential Revision: https://phab.mercurial-scm.org/D7938
tests/test-lfs.t
--- a/tests/test-lfs.t	Fri Jan 17 21:27:53 2020 -0500
+++ b/tests/test-lfs.t	Fri Jan 17 22:24:27 2020 -0800
@@ -810,8 +810,11 @@
 blob, and the output shows that it isn't fetched.
 
   $ cat > $TESTTMP/lfsrename.py <<EOF
+  > import sys
+  > 
   > from mercurial import (
   >     exthelper,
+  >     pycompat,
   > )
   > 
   > from hgext.lfs import (
@@ -829,7 +832,10 @@
   >         rawtext = self._revlog.rawdata(node)
   >         metadata = pointer.deserialize(rawtext)
   >         print('lfs blob %s renamed %s -> %s'
-  >               % (metadata[b'oid'], ret[0], self._revlog.filename))
+  >               % (pycompat.sysstr(metadata[b'oid']),
+  >                  pycompat.sysstr(ret[0]),
+  >                  pycompat.fsdecode(self._revlog.filename)))
+  >         sys.stdout.flush()
   >     return ret
   > EOF