D2510: py3: add b'' prefixes in tests/test-rollback.t

pulkit (Pulkit Goyal) phabricator at mercurial-scm.org
Wed Feb 28 22:30:17 UTC 2018


pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This makes the test run succesfully on Python 3. There is just a b'' prefix
  extra in the output.
  
  1. skip-blame because we added just b'' prefixes

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  tests/test-rollback.t

CHANGE DETAILS

diff --git a/tests/test-rollback.t b/tests/test-rollback.t
--- a/tests/test-rollback.t
+++ b/tests/test-rollback.t
@@ -228,21 +228,21 @@
   > configtable = {}
   > configitem = registrar.configitem(configtable)
   > 
-  > configitem('ui', 'ioerrors',
+  > configitem(b'ui', b'ioerrors',
   >     default=list,
   > )
   > 
   > def pretxncommit(ui, repo, **kwargs):
-  >     ui.warn('warn during pretxncommit\n')
+  >     ui.warn(b'warn during pretxncommit\n')
   > 
   > def pretxnclose(ui, repo, **kwargs):
-  >     ui.warn('warn during pretxnclose\n')
+  >     ui.warn(b'warn during pretxnclose\n')
   > 
   > def txnclose(ui, repo, **kwargs):
-  >     ui.warn('warn during txnclose\n')
+  >     ui.warn(b'warn during txnclose\n')
   > 
   > def txnabort(ui, repo, **kwargs):
-  >     ui.warn('warn during abort\n')
+  >     ui.warn(b'warn during abort\n')
   > 
   > class fdproxy(object):
   >     def __init__(self, ui, o):
@@ -253,25 +253,25 @@
   >         return getattr(self._o, attr)
   > 
   >     def write(self, msg):
-  >         errors = set(self._ui.configlist('ui', 'ioerrors'))
-  >         pretxncommit = msg == 'warn during pretxncommit\n'
-  >         pretxnclose = msg == 'warn during pretxnclose\n'
-  >         txnclose = msg == 'warn during txnclose\n'
-  >         txnabort = msg == 'warn during abort\n'
-  >         msgabort = msg == _('transaction abort!\n')
-  >         msgrollback = msg == _('rollback completed\n')
+  >         errors = set(self._ui.configlist(b'ui', b'ioerrors'))
+  >         pretxncommit = msg == b'warn during pretxncommit\n'
+  >         pretxnclose = msg == b'warn during pretxnclose\n'
+  >         txnclose = msg == b'warn during txnclose\n'
+  >         txnabort = msg == b'warn during abort\n'
+  >         msgabort = msg == _(b'transaction abort!\n')
+  >         msgrollback = msg == _(b'rollback completed\n')
   > 
-  >         if pretxncommit and 'pretxncommit' in errors:
+  >         if pretxncommit and b'pretxncommit' in errors:
   >             raise IOError(errno.EPIPE, 'simulated epipe')
-  >         if pretxnclose and 'pretxnclose' in errors:
+  >         if pretxnclose and b'pretxnclose' in errors:
   >             raise IOError(errno.EIO, 'simulated eio')
-  >         if txnclose and 'txnclose' in errors:
+  >         if txnclose and b'txnclose' in errors:
   >             raise IOError(errno.EBADF, 'simulated badf')
-  >         if txnabort and 'txnabort' in errors:
+  >         if txnabort and b'txnabort' in errors:
   >             raise IOError(errno.EPIPE, 'simulated epipe')
-  >         if msgabort and 'msgabort' in errors:
+  >         if msgabort and b'msgabort' in errors:
   >             raise IOError(errno.EBADF, 'simulated ebadf')
-  >         if msgrollback and 'msgrollback' in errors:
+  >         if msgrollback and b'msgrollback' in errors:
   >             raise IOError(errno.EIO, 'simulated eio')
   > 
   >         return self._o.write(msg)
@@ -289,10 +289,10 @@
   >     ui.__class__ = badui
   > 
   > def reposetup(ui, repo):
-  >     ui.setconfig('hooks', 'pretxnclose.badui', pretxnclose, 'badui')
-  >     ui.setconfig('hooks', 'txnclose.badui', txnclose, 'badui')
-  >     ui.setconfig('hooks', 'pretxncommit.badui', pretxncommit, 'badui')
-  >     ui.setconfig('hooks', 'txnabort.badui', txnabort, 'badui')
+  >     ui.setconfig(b'hooks', b'pretxnclose.badui', pretxnclose, b'badui')
+  >     ui.setconfig(b'hooks', b'txnclose.badui', txnclose, b'badui')
+  >     ui.setconfig(b'hooks', b'pretxncommit.badui', pretxncommit, b'badui')
+  >     ui.setconfig(b'hooks', b'txnabort.badui', txnabort, b'badui')
   > EOF
 
   $ cat >> $HGRCPATH << EOF



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


More information about the Mercurial-devel mailing list