Patchwork D7938: py3: string normalization and I/O tweaks in test-lfs.t

login
register
mail settings
Submitter phabricator
Date Jan. 18, 2020, 7:42 a.m.
Message ID <differential-rev-PHID-DREV-3h4sjsmyot7hhvtifves-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/44514/
State Superseded
Headers show

Comments

phabricator - Jan. 18, 2020, 7:42 a.m.
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D7938

AFFECTED FILES
  tests/test-lfs.t

CHANGE DETAILS




To: indygreg, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/tests/test-lfs.t b/tests/test-lfs.t
--- a/tests/test-lfs.t
+++ b/tests/test-lfs.t
@@ -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