Patchwork [10,of,10,V3] tests: use print_function in silenttestrunner.py

login
register
mail settings
Submitter roby roby
Date April 2, 2016, 3:37 p.m.
Message ID <854723af391b26ef0486.1459611462@roby>
Download mbox | patch
Permalink /patch/14264/
State Accepted
Headers show

Comments

roby roby - April 2, 2016, 3:37 p.m.
# HG changeset patch
# User Robert Stanca <robert.stanca7@gmail.com>
# Date 1459610243 -10800
#      Sat Apr 02 18:17:23 2016 +0300
# Node ID 854723af391b26ef0486028ffac78c7cffeb944b
# Parent  62c51638a70f257f991a40ebb0fd943f5f968c2e
tests: use print_function in silenttestrunner.py
Pierre-Yves David - April 2, 2016, 11:09 p.m.
On 04/02/2016 08:37 AM, Robert Stanca wrote:
> # HG changeset patch
> # User Robert Stanca <robert.stanca7@gmail.com>
> # Date 1459610243 -10800
> #      Sat Apr 02 18:17:23 2016 +0300
> # Node ID 854723af391b26ef0486028ffac78c7cffeb944b
> # Parent  62c51638a70f257f991a40ebb0fd943f5f968c2e
> tests: use print_function in silenttestrunner.py

Pushed, congratulation for your first mercurial patches
Pierre-Yves David - April 3, 2016, 5:13 a.m.
On 04/02/2016 09:41 PM, Pulkit Goyal wrote:
> There will be an error in test-check-*.t tests as the imports are not
> lexicographically sorted.

Tests passed fine here,

Any idea of what is going on?

Cheers,
Yuya Nishihara - April 3, 2016, 6:21 a.m.
On Sat, 2 Apr 2016 22:13:55 -0700, Pierre-Yves David wrote:
> On 04/02/2016 09:41 PM, Pulkit Goyal wrote:
> > There will be an error in test-check-*.t tests as the imports are not
> > lexicographically sorted.  
> 
> Tests passed fine here,
> 
> Any idea of what is going on?

tests/*.py aren't covered by test-check-module-imports.t.

Patch

diff -r 62c51638a70f -r 854723af391b tests/silenttestrunner.py
--- a/tests/silenttestrunner.py	Sat Apr 02 18:16:12 2016 +0300
+++ b/tests/silenttestrunner.py	Sat Apr 02 18:17:23 2016 +0300
@@ -1,4 +1,4 @@ 
-from __future__ import absolute_import
+from __future__ import absolute_import, print_function
 import unittest
 import sys
 import os
@@ -11,12 +11,12 @@ 
     suite.run(results)
     if results.errors or results.failures:
         for tc, exc in results.errors:
-            print 'ERROR:', tc
-            print
+            print('ERROR:', tc)
+            print()
             sys.stdout.write(exc)
         for tc, exc in results.failures:
-            print 'FAIL:', tc
-            print
+            print('FAIL:', tc)
+            print()
             sys.stdout.write(exc)
         sys.exit(1)
 
diff -r 62c51638a70f -r 854723af391b tests/test-check-py3-compat.t
--- a/tests/test-check-py3-compat.t	Sat Apr 02 18:16:12 2016 +0300
+++ b/tests/test-check-py3-compat.t	Sat Apr 02 18:17:23 2016 +0300
@@ -51,7 +51,6 @@ 
   tests/readlink.py requires print_function
   tests/revlog-formatv0.py not using absolute_import
   tests/run-tests.py not using absolute_import
-  tests/silenttestrunner.py requires print_function
   tests/sitecustomize.py not using absolute_import
   tests/svn-safe-append.py not using absolute_import
   tests/svnxml.py not using absolute_import
@@ -265,7 +264,6 @@ 
   mercurial/windows.py: error importing module: <ImportError> No module named '_winreg' (line 10)
   mercurial/wireproto.py: error importing module: <SyntaxError> invalid syntax (bundle*.py, line *) (line *) (glob)
   tests/readlink.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
-  tests/silenttestrunner.py: invalid syntax: Missing parentheses in call to 'print' (<unknown>, line *) (glob)
   tests/test-batching.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
   tests/test-bdiff.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
   tests/test-context.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)