From be19ed77ddb047e02fe94d142181062af6d99dcc Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Fri, 9 Feb 2007 05:37:30 +0000 Subject: Fix most trivially-findable print statements. There's one major and one minor category still unfixed: doctests are the major category (and I hope to be able to augment the refactoring tool to refactor bona fide doctests soon); other code generating print statements in strings is the minor category. (Oh, and I don't know if the compiler package works.) --- Lib/test/test_support.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'Lib/test/test_support.py') diff --git a/Lib/test/test_support.py b/Lib/test/test_support.py index 0b37306a62..6cc52ea05b 100644 --- a/Lib/test/test_support.py +++ b/Lib/test/test_support.py @@ -106,8 +106,7 @@ def bind_port(sock, host='', preferred_port=54321): (err, msg) = e if err != errno.EADDRINUSE: raise - print >>sys.__stderr__, \ - ' WARNING: failed to listen on port %d, trying another' % port + print(' WARNING: failed to listen on port %d, trying another' % port, file=sys.__stderr__) raise TestFailed, 'unable to find port to listen on' FUZZ = 1e-6 @@ -178,10 +177,9 @@ else: except UnicodeEncodeError: pass else: - print \ - 'WARNING: The filename %r CAN be encoded by the filesystem. ' \ + print('WARNING: The filename %r CAN be encoded by the filesystem. ' \ 'Unicode filename tests may not be effective' \ - % TESTFN_UNICODE_UNENCODEABLE + % TESTFN_UNICODE_UNENCODEABLE) # Make sure we can write to TESTFN, try in /tmp if we can't fp = None @@ -194,8 +192,8 @@ except IOError: TESTFN = TMP_TESTFN del TMP_TESTFN except IOError: - print ('WARNING: tests will fail, unable to write to: %s or %s' % - (TESTFN, TMP_TESTFN)) + print(('WARNING: tests will fail, unable to write to: %s or %s' % + (TESTFN, TMP_TESTFN))) if fp is not None: fp.close() unlink(TESTFN) @@ -267,7 +265,7 @@ def open_urlresource(url): return open(fn) requires('urlfetch') - print >> get_original_stdout(), '\tfetching %s ...' % url + print('\tfetching %s ...' % url, file=get_original_stdout()) fn, _ = urllib.urlretrieve(url, filename) return open(fn) @@ -514,7 +512,7 @@ def run_doctest(module, verbosity=None): finally: sys.stdout = save_stdout if verbose: - print 'doctest (%s) ... %d tests with zero failures' % (module.__name__, t) + print('doctest (%s) ... %d tests with zero failures' % (module.__name__, t)) return f, t #======================================================================= -- cgit v1.2.1