[PATCH]multiple: use absolute_import , print_function

roby roby robert.stanca7 at gmail.com
Fri Mar 25 07:27:54 EDT 2016


# HG changeset patch
# User Robert Stanca <robert.stanca7 at gmail.com>
# Date 1458905221 -7200
#      Fri Mar 25 13:27:01 2016 +0200
# Node ID 335fd37954517b9c1ffce5eb60ec945d5fc99505
# Parent  916d835bb60d537d47ebc6fb24b7abc20a628d42
multiple: use absolute_import , print_function

diff -r 916d835bb60d -r 335fd3795451 tests/test-check-py3-compat.t
--- a/tests/test-check-py3-compat.t    Fri Mar 25 13:15:36 2016 +0200
+++ b/tests/test-check-py3-compat.t    Fri Mar 25 13:27:01 2016 +0200
@@ -53,12 +53,6 @@
   tests/svnxml.py not using absolute_import
   tests/test-atomictempfile.py not using absolute_import
   tests/test-doctest.py not using absolute_import
-  tests/test-duplicateoptions.py not using absolute_import
-  tests/test-duplicateoptions.py requires print_function
-  tests/test-filecache.py not using absolute_import
-  tests/test-filecache.py requires print_function
-  tests/test-filelog.py not using absolute_import
-  tests/test-filelog.py requires print_function
   tests/test-hg-parseurl.py not using absolute_import
   tests/test-hg-parseurl.py requires print_function
   tests/test-hgweb-auth.py not using absolute_import
diff -r 916d835bb60d -r 335fd3795451 tests/test-duplicateoptions.py
--- a/tests/test-duplicateoptions.py    Fri Mar 25 13:15:36 2016 +0200
+++ b/tests/test-duplicateoptions.py    Fri Mar 25 13:27:01 2016 +0200
@@ -1,5 +1,10 @@
+from __future__ import absolute_import, print_function
 import os
-from mercurial import ui, commands, extensions
+from mercurial import (
+    ui,
+    commands,
+    extensions,
+)

 ignore = set(['highlight', 'win32text', 'factotum'])

@@ -31,6 +36,6 @@
     for option in entry[1]:
         if (option[0] and option[0] in seenshort) or \
            (option[1] and option[1] in seenlong):
-            print "command '" + cmd + "' has duplicate option " +
str(option)
+            print ("command '" + cmd + "' has duplicate option " +
str(option))
         seenshort.add(option[0])
         seenlong.add(option[1])
diff -r 916d835bb60d -r 335fd3795451 tests/test-filecache.py
--- a/tests/test-filecache.py    Fri Mar 25 13:15:36 2016 +0200
+++ b/tests/test-filecache.py    Fri Mar 25 13:27:01 2016 +0200
@@ -1,10 +1,19 @@
-import sys, os, subprocess
+from __future__ import absolute_import, print_function
+import os
+import subprocess
+import sys

 if subprocess.call(['python', '%s/hghave' % os.environ['TESTDIR'],
                     'cacheable']):
     sys.exit(80)

-from mercurial import util, scmutil, extensions, hg, ui
+from mercurial import (
+    util,
+    scmutil,
+    extensions,
+    hg,
+    ui,
+)

 filecache = scmutil.filecache

@@ -20,7 +29,7 @@

     @filecache('x', 'y')
     def cached(self):
-        print 'creating'
+        print ('creating')
         return 'string from function'

     def invalidate(self):
@@ -31,12 +40,12 @@
                 pass

 def basic(repo):
-    print "* neither file exists"
+    print ("* neither file exists")
     # calls function
     repo.cached

     repo.invalidate()
-    print "* neither file still exists"
+    print ("* neither file still exists")
     # uses cache
     repo.cached

@@ -44,7 +53,7 @@
     f = open('x', 'w')
     f.close()
     repo.invalidate()
-    print "* empty file x created"
+    print ("* empty file x created")
     # should recreate the object
     repo.cached

@@ -52,12 +61,12 @@
     f.write('a')
     f.close()
     repo.invalidate()
-    print "* file x changed size"
+    print ("* file x changed size")
     # should recreate the object
     repo.cached

     repo.invalidate()
-    print "* nothing changed with either file"
+    print ("* nothing changed with either file")
     # stats file again, reuses object
     repo.cached

@@ -69,14 +78,14 @@
     f.close()

     repo.invalidate()
-    print "* file x changed inode"
+    print ("* file x changed inode")
     repo.cached

     # create empty file y
     f = open('y', 'w')
     f.close()
     repo.invalidate()
-    print "* empty file y created"
+    print ("* empty file y created")
     # should recreate the object
     repo.cached

@@ -84,7 +93,7 @@
     f.write('A')
     f.close()
     repo.invalidate()
-    print "* file y changed size"
+    print ("* file y changed size")
     # should recreate the object
     repo.cached

@@ -93,7 +102,7 @@
     f.close()

     repo.invalidate()
-    print "* file y changed inode"
+    print ("* file y changed inode")
     repo.cached

     f = scmutil.opener('.')('x', 'w', atomictemp=True)
@@ -104,7 +113,7 @@
     f.close()

     repo.invalidate()
-    print "* both files changed inode"
+    print ("* both files changed inode")
     repo.cached

 def fakeuncacheable():
@@ -149,36 +158,36 @@
     os.remove('y')
     repo.cached = 'string set externally'
     repo.invalidate()
-    print "* neither file exists"
-    print repo.cached
+    print ("* neither file exists")
+    print (repo.cached)
     repo.invalidate()
     f = open('x', 'w')
     f.write('a')
     f.close()
-    print "* file x created"
-    print repo.cached
+    print ("* file x created")
+    print (repo.cached)

     repo.cached = 'string 2 set externally'
     repo.invalidate()
-    print "* string set externally again"
-    print repo.cached
+    print ("* string set externally again")
+    print (repo.cached)

     repo.invalidate()
     f = open('y', 'w')
     f.write('b')
     f.close()
-    print "* file y created"
-    print repo.cached
+    print ("* file y created")
+    print (repo.cached)

-print 'basic:'
-print
+print ('basic:')
+print ()
 basic(fakerepo())
-print
-print 'fakeuncacheable:'
-print
+print ()
+print ('fakeuncacheable:')
+print ()
 fakeuncacheable()
 test_filecache_synced()
-print
-print 'setbeforeget:'
-print
+print ()
+print ('setbeforeget:')
+print ()
 setbeforeget(fakerepo())
diff -r 916d835bb60d -r 335fd3795451 tests/test-filelog.py
--- a/tests/test-filelog.py    Fri Mar 25 13:15:36 2016 +0200
+++ b/tests/test-filelog.py    Fri Mar 25 13:27:01 2016 +0200
@@ -2,8 +2,15 @@
 """
 Tests the behavior of filelog w.r.t. data starting with '\1\n'
 """
-from mercurial import ui, hg
-from mercurial.node import nullid, hex
+from __future__ import absolute_import, print_function
+from mercurial import (
+    ui,
+    hg,
+)
+from mercurial.node import (
+    nullid,
+    hex,
+)

 myui = ui.ui()
 repo = hg.repository(myui, path='.', create=True)
@@ -30,7 +37,7 @@
             lock.release()

 def error(text):
-    print 'ERROR: ' + text
+    print ('ERROR: ' + text)

 textwith = '\1\nfoo'
 without = 'foo'
@@ -52,4 +59,4 @@
 if fl.size(1) != len(textwith):
     error('filelog.size for a renaming + data starting with \\1\\n')

-print 'OK.'
+print ('OK.')
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mercurial-scm.org/pipermail/mercurial-devel/attachments/20160325/38185112/attachment.html>


More information about the Mercurial-devel mailing list