D4992: tests: so many b prefixes in test-extension.t

durin42 (Augie Fackler) phabricator at mercurial-scm.org
Fri Oct 12 11:23:44 EDT 2018


durin42 updated this revision to Diff 11892.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4992?vs=11874&id=11892

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

AFFECTED FILES
  tests/test-extension.t

CHANGE DETAILS

diff --git a/tests/test-extension.t b/tests/test-extension.t
--- a/tests/test-extension.t
+++ b/tests/test-extension.t
@@ -222,20 +222,21 @@
 
   $ mkdir $TESTTMP/extroot
   $ cat > $TESTTMP/extroot/bar.py <<EOF
-  > s = 'this is extroot.bar'
+  > s = b'this is extroot.bar'
   > EOF
   $ mkdir $TESTTMP/extroot/sub1
   $ cat > $TESTTMP/extroot/sub1/__init__.py <<EOF
-  > s = 'this is extroot.sub1.__init__'
+  > s = b'this is extroot.sub1.__init__'
   > EOF
   $ cat > $TESTTMP/extroot/sub1/baz.py <<EOF
-  > s = 'this is extroot.sub1.baz'
+  > s = b'this is extroot.sub1.baz'
   > EOF
   $ cat > $TESTTMP/extroot/__init__.py <<EOF
-  > s = 'this is extroot.__init__'
-  > import foo
+  > from __future__ import absolute_import
+  > s = b'this is extroot.__init__'
+  > from . import foo
   > def extsetup(ui):
-  >     ui.write('(extroot) ', foo.func(), '\n')
+  >     ui.write(b'(extroot) ', foo.func(), b'\n')
   >     ui.flush()
   > EOF
 
@@ -245,20 +246,20 @@
   > def func():
   >     # "not locals" case
   >     import extroot.bar
-  >     buf.append('import extroot.bar in func(): %s' % extroot.bar.s)
-  >     return '\n(extroot) '.join(buf)
-  > # "fromlist == ('*',)" case
+  >     buf.append(b'import extroot.bar in func(): %s' % extroot.bar.s)
+  >     return b'\n(extroot) '.join(buf)
+  > # b"fromlist == ('*',)" case
   > from extroot.bar import *
-  > buf.append('from extroot.bar import *: %s' % s)
+  > buf.append(b'from extroot.bar import *: %s' % s)
   > # "not fromlist" and "if '.' in name" case
   > import extroot.sub1.baz
-  > buf.append('import extroot.sub1.baz: %s' % extroot.sub1.baz.s)
+  > buf.append(b'import extroot.sub1.baz: %s' % extroot.sub1.baz.s)
   > # "not fromlist" and NOT "if '.' in name" case
   > import extroot
-  > buf.append('import extroot: %s' % extroot.s)
+  > buf.append(b'import extroot: %s' % extroot.s)
   > # NOT "not fromlist" and NOT "level != -1" case
   > from extroot.bar import s
-  > buf.append('from extroot.bar import s: %s' % s)
+  > buf.append(b'from extroot.bar import s: %s' % s)
   > EOF
   $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}; hg --config extensions.extroot=$TESTTMP/extroot root)
   (extroot) from extroot.bar import *: this is extroot.bar
@@ -461,12 +462,12 @@
   > @command(b'showabsolute', [], norepo=True)
   > def showabsolute(ui, *args, **opts):
   >     from absextroot import absolute
-  >     ui.write(b'ABS: %s\n' % '\nABS: '.join(absolute.getresult()))
+  >     ui.write(b'ABS: %s\n' % b'\nABS: '.join(absolute.getresult()))
   > 
   > @command(b'showrelative', [], norepo=True)
   > def showrelative(ui, *args, **opts):
   >     from . import relative
-  >     ui.write(b'REL: %s\n' % '\nREL: '.join(relative.getresult()))
+  >     ui.write(b'REL: %s\n' % b'\nREL: '.join(relative.getresult()))
   > 
   > # import modules from external library
   > from extlibroot.lsub1.lsub2 import used as lused, unused as lunused
@@ -481,7 +482,7 @@
   >     result.append(absdetail)
   >     result.append(legacydetail)
   >     result.append(proxied.detail)
-  >     ui.write(b'LIB: %s\n' % '\nLIB: '.join(result))
+  >     ui.write(b'LIB: %s\n' % b'\nLIB: '.join(result))
   > EOF
 
 Examine module importing.



To: durin42, #hg-reviewers, pulkit
Cc: mercurial-devel


More information about the Mercurial-devel mailing list