[PATCH 6 of 6 V3] tests: use print_function in test-context.py
Robert Stanca
robert.stanca7 at gmail.com
Sat Apr 2 23:52:25 EDT 2016
# HG changeset patch
# User Robert Stanca <robert.stanca7 at gmail.com>
# Date 1459653905 -10800
# Sun Apr 03 06:25:05 2016 +0300
# Node ID 47bb369e47eee3387ab49c6f6a5a0c3bd607a392
# Parent 3b0991496c4062cbc9970e701b323cb56331540f
tests: use print_function in test-context.py
diff -r 3b0991496c40 -r 47bb369e47ee tests/test-check-py3-compat.t
--- a/tests/test-check-py3-compat.t Sun Apr 03 06:20:17 2016 +0300
+++ b/tests/test-check-py3-compat.t Sun Apr 03 06:25:05 2016 +0300
@@ -53,7 +53,6 @@
tests/svn-safe-append.py not using absolute_import
tests/svnxml.py not using absolute_import
tests/test-atomictempfile.py not using absolute_import
- tests/test-context.py requires print_function
tests/test-demandimport.py not using absolute_import
tests/test-demandimport.py requires print_function
tests/test-doctest.py not using absolute_import
@@ -164,7 +163,6 @@
mercurial/cmdutil.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
mercurial/commands.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
mercurial/commandserver.py: error importing module: <ImportError> No module named 'SocketServer' (line *) (glob)
- mercurial/context.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
mercurial/copies.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
mercurial/crecord.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
mercurial/dirstate.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
diff -r 3b0991496c40 -r 47bb369e47ee tests/test-context.py
--- a/tests/test-context.py Sun Apr 03 06:20:17 2016 +0300
+++ b/tests/test-context.py Sun Apr 03 06:25:05 2016 +0300
@@ -1,4 +1,4 @@
-from __future__ import absolute_import
+from __future__ import absolute_import, print_function
import os
from mercurial import (
hg,
@@ -24,9 +24,9 @@
if os.name == 'nt':
d = repo[None]['foo'].date()
- print "workingfilectx.date = (%d, %d)" % (d[0], d[1])
+ print("workingfilectx.date = (%d, %d)" % (d[0], d[1]))
else:
- print "workingfilectx.date =", repo[None]['foo'].date()
+ print("workingfilectx.date =", repo[None]['foo'].date())
# test memctx with non-ASCII commit message
@@ -39,7 +39,7 @@
ctx.commit()
for enc in "ASCII", "Latin-1", "UTF-8":
encoding.encoding = enc
- print "%-8s: %s" % (enc, repo["tip"].description())
+ print("%-8s: %s" % (enc, repo["tip"].description()))
# test performing a status
@@ -54,15 +54,15 @@
ctxb = context.memctx(repo, [ctxa.node(), None], "test diff", ["foo"],
getfilectx, ctxa.user(), ctxa.date())
-print ctxb.status(ctxa)
+print(ctxb.status(ctxa))
# test performing a diff on a memctx
for d in ctxb.diff(ctxa, git=True):
- print d
+ print(d)
# test safeness and correctness of "ctx.status()"
-print '= checking context.status():'
+print('= checking context.status():')
# ancestor "wcctx ~ 2"
actx2 = repo['.']
@@ -88,26 +88,26 @@
from mercurial import scmutil
-print '== checking workingctx.status:'
+print('== checking workingctx.status:')
wctx = repo[None]
-print 'wctx._status=%s' % (str(wctx._status))
+print('wctx._status=%s' % (str(wctx._status)))
-print '=== with "pattern match":'
-print actx1.status(other=wctx,
- match=scmutil.matchfiles(repo, ['bar-m', 'foo']))
-print 'wctx._status=%s' % (str(wctx._status))
-print actx2.status(other=wctx,
- match=scmutil.matchfiles(repo, ['bar-m', 'foo']))
-print 'wctx._status=%s' % (str(wctx._status))
+print('=== with "pattern match":')
+print(actx1.status(other=wctx,
+ match=scmutil.matchfiles(repo, ['bar-m', 'foo'])))
+print('wctx._status=%s' % (str(wctx._status)))
+print(actx2.status(other=wctx,
+ match=scmutil.matchfiles(repo, ['bar-m', 'foo'])))
+print('wctx._status=%s' % (str(wctx._status)))
-print '=== with "always match" and "listclean=True":'
-print actx1.status(other=wctx, listclean=True)
-print 'wctx._status=%s' % (str(wctx._status))
-print actx2.status(other=wctx, listclean=True)
-print 'wctx._status=%s' % (str(wctx._status))
+print('=== with "always match" and "listclean=True":')
+print(actx1.status(other=wctx, listclean=True))
+print('wctx._status=%s' % (str(wctx._status)))
+print(actx2.status(other=wctx, listclean=True))
+print('wctx._status=%s' % (str(wctx._status)))
-print "== checking workingcommitctx.status:"
+print("== checking workingcommitctx.status:")
wcctx = context.workingcommitctx(repo,
scmutil.status(['bar-m'],
@@ -115,34 +115,34 @@
[],
[], [], [], []),
text='', date='0 0')
-print 'wcctx._status=%s' % (str(wcctx._status))
+print('wcctx._status=%s' % (str(wcctx._status)))
-print '=== with "always match":'
-print actx1.status(other=wcctx)
-print 'wcctx._status=%s' % (str(wcctx._status))
-print actx2.status(other=wcctx)
-print 'wcctx._status=%s' % (str(wcctx._status))
+print('=== with "always match":')
+print(actx1.status(other=wcctx))
+print('wcctx._status=%s' % (str(wcctx._status)))
+print(actx2.status(other=wcctx))
+print('wcctx._status=%s' % (str(wcctx._status)))
-print '=== with "always match" and "listclean=True":'
-print actx1.status(other=wcctx, listclean=True)
-print 'wcctx._status=%s' % (str(wcctx._status))
-print actx2.status(other=wcctx, listclean=True)
-print 'wcctx._status=%s' % (str(wcctx._status))
+print('=== with "always match" and "listclean=True":')
+print(actx1.status(other=wcctx, listclean=True))
+print('wcctx._status=%s' % (str(wcctx._status)))
+print(actx2.status(other=wcctx, listclean=True))
+print('wcctx._status=%s' % (str(wcctx._status)))
-print '=== with "pattern match":'
-print actx1.status(other=wcctx,
- match=scmutil.matchfiles(repo, ['bar-m', 'foo']))
-print 'wcctx._status=%s' % (str(wcctx._status))
-print actx2.status(other=wcctx,
- match=scmutil.matchfiles(repo, ['bar-m', 'foo']))
-print 'wcctx._status=%s' % (str(wcctx._status))
+print('=== with "pattern match":')
+print(actx1.status(other=wcctx,
+ match=scmutil.matchfiles(repo, ['bar-m', 'foo'])))
+print('wcctx._status=%s' % (str(wcctx._status)))
+print(actx2.status(other=wcctx,
+ match=scmutil.matchfiles(repo, ['bar-m', 'foo'])))
+print('wcctx._status=%s' % (str(wcctx._status)))
-print '=== with "pattern match" and "listclean=True":'
-print actx1.status(other=wcctx,
+print('=== with "pattern match" and "listclean=True":')
+print(actx1.status(other=wcctx,
match=scmutil.matchfiles(repo, ['bar-r', 'foo']),
- listclean=True)
-print 'wcctx._status=%s' % (str(wcctx._status))
-print actx2.status(other=wcctx,
+ listclean=True))
+print('wcctx._status=%s' % (str(wcctx._status)))
+print(actx2.status(other=wcctx,
match=scmutil.matchfiles(repo, ['bar-r', 'foo']),
- listclean=True)
-print 'wcctx._status=%s' % (str(wcctx._status))
+ listclean=True))
+print('wcctx._status=%s' % (str(wcctx._status)))
More information about the Mercurial-devel
mailing list