[PATCH] tests: use absolute_import and print_function

Robert Stanca robert.stanca7 at gmail.com
Wed Mar 30 21:01:27 UTC 2016


# HG changeset patch
# User Robert Stanca <robert.stanca7 at gmail.com>
# Date 1459369672 -10800
#      Wed Mar 30 23:27:52 2016 +0300
# Node ID 3a90d46f16597a6e5833b60e5f808d9246b19823
# Parent  ff0d3b6b287f89594bd8d0308fe2810d2a18ea01
tests: use absolute_import and print_function

Eliminate Python3 compatibility warnings

diff -r ff0d3b6b287f -r 3a90d46f1659 tests/test-check-py3-compat.t
--- a/tests/test-check-py3-compat.t	Tue Mar 29 12:29:00 2016 -0500
+++ b/tests/test-check-py3-compat.t	Wed Mar 30 23:27:52 2016 +0300
@@ -94,8 +94,6 @@
   tests/test-minirst.py requires print_function
   tests/test-parseindex2.py not using absolute_import
   tests/test-parseindex2.py requires print_function
-  tests/test-pathencode.py not using absolute_import
-  tests/test-pathencode.py requires print_function
   tests/test-propertycache.py not using absolute_import
   tests/test-propertycache.py requires print_function
   tests/test-revlog-ancestry.py not using absolute_import
diff -r ff0d3b6b287f -r 3a90d46f1659 tests/test-pathencode.py
--- a/tests/test-pathencode.py	Tue Mar 29 12:29:00 2016 -0500
+++ b/tests/test-pathencode.py	Wed Mar 30 23:27:52 2016 +0300
@@ -5,9 +5,16 @@
 # that have proven likely to expose bugs and divergent behavior in
 # different encoding implementations.
 
+from __future__ import absolute_import, print_function
 from mercurial import store
-import binascii, itertools, math, os, random, sys, time
+import binascii
 import collections
+import itertools
+import math
+import os
+import random
+import sys
+import time
 
 validchars = set(map(chr, range(0, 256)))
 alphanum = range(ord('A'), ord('Z'))
@@ -154,10 +161,10 @@
         r = store._hybridencode(p, True) # reference implementation in Python
         if h != r:
             if nerrs == 0:
-                print >> sys.stderr, 'seed:', hex(seed)[:-1]
-            print >> sys.stderr, "\np: '%s'" % p.encode("string_escape")
-            print >> sys.stderr, "h: '%s'" % h.encode("string_escape")
-            print >> sys.stderr, "r: '%s'" % r.encode("string_escape")
+                print('seed:', hex(seed)[:-1], file = sys.stderr)
+            print("\np: '%s'" % p.encode("string_escape"), file = sys.stderr)
+            print("h: '%s'" % h.encode("string_escape"), file = sys.stderr)
+            print("r: '%s'" % r.encode("string_escape"), file = sys.stderr)
             nerrs += 1
     return nerrs
 


More information about the Mercurial-devel mailing list