Index: Lib/distutils/tests/test_dist.py =================================================================== --- Lib/distutils/tests/test_dist.py (revision 62290) +++ Lib/distutils/tests/test_dist.py (working copy) @@ -7,7 +7,7 @@ import sys import unittest -from test.test_support import TESTFN +from test.support import TESTFN class test_dist(distutils.cmd.Command): Index: Lib/distutils/tests/test_sysconfig.py =================================================================== --- Lib/distutils/tests/test_sysconfig.py (revision 62290) +++ Lib/distutils/tests/test_sysconfig.py (working copy) @@ -4,7 +4,7 @@ import os import unittest -from test.test_support import TESTFN +from test.support import TESTFN class SysconfigTestCase(unittest.TestCase): Index: Lib/distutils/tests/test_core.py =================================================================== --- Lib/distutils/tests/test_core.py (revision 62290) +++ Lib/distutils/tests/test_core.py (working copy) @@ -5,7 +5,7 @@ import os import shutil import sys -import test.test_support +import test.support import unittest @@ -39,13 +39,13 @@ self.cleanup_testfn() def cleanup_testfn(self): - path = test.test_support.TESTFN + path = test.support.TESTFN if os.path.isfile(path): os.remove(path) elif os.path.isdir(path): shutil.rmtree(path) - def write_setup(self, text, path=test.test_support.TESTFN): + def write_setup(self, text, path=test.support.TESTFN): open(path, "w").write(text) return path @@ -63,8 +63,8 @@ cwd = os.getcwd() # Create a directory and write the setup.py file there: - os.mkdir(test.test_support.TESTFN) - setup_py = os.path.join(test.test_support.TESTFN, "setup.py") + os.mkdir(test.support.TESTFN) + setup_py = os.path.join(test.support.TESTFN, "setup.py") distutils.core.run_setup( self.write_setup(setup_prints_cwd, path=setup_py)) Index: Lib/bsddb/test/test_cursor_pget_bug.py =================================================================== --- Lib/bsddb/test/test_cursor_pget_bug.py (revision 62290) +++ Lib/bsddb/test/test_cursor_pget_bug.py (working copy) @@ -12,7 +12,7 @@ try: from bsddb3 import test_support except ImportError: - from test import test_support + from test import support #---------------------------------------------------------------------- Index: Lib/bsddb/test/test_misc.py =================================================================== --- Lib/bsddb/test/test_misc.py (revision 62290) +++ Lib/bsddb/test/test_misc.py (working copy) @@ -15,7 +15,7 @@ try: from bsddb3 import test_support except ImportError: - from test import test_support + from test import support #---------------------------------------------------------------------- Index: Lib/bsddb/test/test_dbshelve.py =================================================================== --- Lib/bsddb/test/test_dbshelve.py (revision 62290) +++ Lib/bsddb/test/test_dbshelve.py (working copy) @@ -17,7 +17,7 @@ try: from bsddb3 import test_support except ImportError: - from test import test_support + from test import support from test_all import verbose Index: Lib/bsddb/test/test_join.py =================================================================== --- Lib/bsddb/test/test_join.py (revision 62290) +++ Lib/bsddb/test/test_join.py (working copy) @@ -23,7 +23,7 @@ try: from bsddb3 import test_support except ImportError: - from test import test_support + from test import support #---------------------------------------------------------------------- Index: Lib/bsddb/test/test_basics.py =================================================================== --- Lib/bsddb/test/test_basics.py (revision 62290) +++ Lib/bsddb/test/test_basics.py (working copy) @@ -21,7 +21,7 @@ try: from bsddb3 import test_support except ImportError: - from test import test_support + from test import support from test_all import verbose Index: Lib/bsddb/test/test_recno.py =================================================================== --- Lib/bsddb/test/test_recno.py (revision 62290) +++ Lib/bsddb/test/test_recno.py (working copy) @@ -19,7 +19,7 @@ try: from bsddb3 import test_support except ImportError: - from test import test_support + from test import support letters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' Index: Lib/bsddb/test/test_pickle.py =================================================================== --- Lib/bsddb/test/test_pickle.py (revision 62290) +++ Lib/bsddb/test/test_pickle.py (working copy) @@ -18,7 +18,7 @@ try: from bsddb3 import test_support except ImportError: - from test import test_support + from test import support #---------------------------------------------------------------------- Index: Lib/bsddb/test/test_thread.py =================================================================== --- Lib/bsddb/test/test_thread.py (revision 62290) +++ Lib/bsddb/test/test_thread.py (working copy) @@ -41,7 +41,7 @@ try: from bsddb3 import test_support except ImportError: - from test import test_support + from test import support #---------------------------------------------------------------------- Index: Lib/bsddb/test/test_sequence.py =================================================================== --- Lib/bsddb/test/test_sequence.py (revision 62290) +++ Lib/bsddb/test/test_sequence.py (working copy) @@ -11,7 +11,7 @@ try: from bsddb3 import test_support except ImportError: - from test import test_support + from test import support class DBSequenceTest(unittest.TestCase): Index: Lib/bsddb/test/test_associate.py =================================================================== --- Lib/bsddb/test/test_associate.py (revision 62290) +++ Lib/bsddb/test/test_associate.py (working copy) @@ -26,7 +26,7 @@ try: from bsddb3 import test_support except ImportError: - from test import test_support + from test import support #---------------------------------------------------------------------- Index: Lib/bsddb/test/test_env_close.py =================================================================== --- Lib/bsddb/test/test_env_close.py (revision 62290) +++ Lib/bsddb/test/test_env_close.py (working copy) @@ -16,7 +16,7 @@ try: from bsddb3 import test_support except ImportError: - from test import test_support + from test import support from test_all import verbose Index: Lib/bsddb/test/test_dbtables.py =================================================================== --- Lib/bsddb/test/test_dbtables.py (revision 62290) +++ Lib/bsddb/test/test_dbtables.py (working copy) @@ -42,7 +42,7 @@ try: from bsddb3 import test_support except ImportError: - from test import test_support + from test import support #---------------------------------------------------------------------- Index: Lib/bsddb/test/test_dbobj.py =================================================================== --- Lib/bsddb/test/test_dbobj.py (revision 62290) +++ Lib/bsddb/test/test_dbobj.py (working copy) @@ -13,7 +13,7 @@ try: from bsddb3 import test_support except ImportError: - from test import test_support + from test import support #---------------------------------------------------------------------- Index: Lib/bsddb/test/test_1413192.py =================================================================== --- Lib/bsddb/test/test_1413192.py (revision 62290) +++ Lib/bsddb/test/test_1413192.py (working copy) @@ -5,7 +5,7 @@ import shutil import tempfile -from test.test_support import catch_warning +from test.support import catch_warning import warnings try: Index: Lib/bsddb/test/test_compare.py =================================================================== --- Lib/bsddb/test/test_compare.py (revision 62290) +++ Lib/bsddb/test/test_compare.py (working copy) @@ -18,7 +18,7 @@ try: from bsddb3 import test_support except ImportError: - from test import test_support + from test import support lexical_cmp = cmp Index: Lib/bsddb/test/test_lock.py =================================================================== --- Lib/bsddb/test/test_lock.py (revision 62290) +++ Lib/bsddb/test/test_lock.py (working copy) @@ -25,7 +25,7 @@ try: from bsddb3 import test_support except ImportError: - from test import test_support + from test import support #---------------------------------------------------------------------- Index: Lib/email/test/test_email_torture.py =================================================================== --- Lib/email/test/test_email_torture.py (revision 62290) +++ Lib/email/test/test_email_torture.py (working copy) @@ -13,7 +13,7 @@ from types import ListType from email.test.test_email import TestEmailBase -from test.test_support import TestSkipped +from test.support import TestSkipped import email from email import __file__ as testfile Index: Lib/email/test/test_email_codecs_renamed.py =================================================================== --- Lib/email/test/test_email_codecs_renamed.py (revision 62290) +++ Lib/email/test/test_email_codecs_renamed.py (working copy) @@ -3,7 +3,7 @@ # email package unit tests for (optional) Asian codecs import unittest -from test.test_support import TestSkipped, run_unittest +from test.support import TestSkipped, run_unittest from email.test.test_email import TestEmailBase from email.charset import Charset Index: Lib/email/test/test_email_renamed.py =================================================================== --- Lib/email/test/test_email_renamed.py (revision 62290) +++ Lib/email/test/test_email_renamed.py (working copy) @@ -32,7 +32,7 @@ from email import base64mime from email import quoprimime -from test.test_support import findfile, run_unittest +from test.support import findfile, run_unittest from email.test import __file__ as landmark Index: Lib/email/test/test_email.py =================================================================== --- Lib/email/test/test_email.py (revision 62290) +++ Lib/email/test/test_email.py (working copy) @@ -31,7 +31,7 @@ from email import base64MIME from email import quopriMIME -from test.test_support import findfile, run_unittest +from test.support import findfile, run_unittest from email.test import __file__ as landmark Index: Lib/email/test/test_email_codecs.py =================================================================== --- Lib/email/test/test_email_codecs.py (revision 62290) +++ Lib/email/test/test_email_codecs.py (working copy) @@ -3,7 +3,7 @@ # email package unit tests for (optional) Asian codecs import unittest -from test.test_support import TestSkipped, run_unittest +from test.support import TestSkipped, run_unittest from email.test.test_email import TestEmailBase from email.Charset import Charset Index: Lib/test/test_math.py =================================================================== --- Lib/test/test_math.py (revision 62290) +++ Lib/test/test_math.py (working copy) @@ -1,7 +1,7 @@ # Python test set -- math module # XXXX Should not do tests around zero only -from test.test_support import run_unittest, verbose +from test.support import run_unittest, verbose import unittest import math Index: Lib/test/test_csv.py =================================================================== --- Lib/test/test_csv.py (revision 62290) +++ Lib/test/test_csv.py (working copy) @@ -9,7 +9,7 @@ import tempfile import csv import gc -from test import test_support +from test import support class Test_Csv(unittest.TestCase): """ @@ -900,7 +900,7 @@ self.assertEqual(dialect.quotechar, "'") if not hasattr(sys, "gettotalrefcount"): - if test_support.verbose: print "*** skipping leakage tests ***" + if support.verbose: print "*** skipping leakage tests ***" else: class NUL: def write(s, *args): @@ -989,7 +989,7 @@ def test_main(): mod = sys.modules[__name__] - test_support.run_unittest( + support.run_unittest( *[getattr(mod, name) for name in dir(mod) if name.startswith('Test')] ) Index: Lib/test/test_extcall.py =================================================================== --- Lib/test/test_extcall.py (revision 62290) +++ Lib/test/test_extcall.py (working copy) @@ -11,10 +11,10 @@ ... print a, b >>> def f(*a, **k): - ... print a, test_support.sortdict(k) + ... print a, support.sortdict(k) >>> def g(x, *y, **z): - ... print x, y, test_support.sortdict(z) + ... print x, y, support.sortdict(z) >>> def h(j=1, a=2, h=3): ... print j, a, h @@ -252,11 +252,11 @@ """ -from test import test_support +from test import support def test_main(): from test import test_extcall # self import - test_support.run_doctest(test_extcall, True) + support.run_doctest(test_extcall, True) if __name__ == '__main__': test_main() Index: Lib/test/test_urllib2_localnet.py =================================================================== --- Lib/test/test_urllib2_localnet.py (revision 62290) +++ Lib/test/test_urllib2_localnet.py (working copy) @@ -7,7 +7,7 @@ import BaseHTTPServer import unittest import hashlib -from test import test_support +from test import support # Loopback http server infrastructure @@ -482,10 +482,10 @@ # (Lib/test/regrtest.py -u network) since all tests here are only # localhost. However, if this is a bad rationale, then uncomment # the next line. - #test_support.requires("network") + #support.requires("network") - test_support.run_unittest(ProxyAuthTests) - test_support.run_unittest(TestUrlopen) + support.run_unittest(ProxyAuthTests) + support.run_unittest(TestUrlopen) if __name__ == "__main__": test_main() Index: Lib/test/test_optparse.py =================================================================== --- Lib/test/test_optparse.py (revision 62290) +++ Lib/test/test_optparse.py (working copy) @@ -16,7 +16,7 @@ import unittest from StringIO import StringIO -from test import test_support +from test import support from optparse import make_option, Option, IndentedHelpFormatter, \ @@ -1020,10 +1020,10 @@ self.parser.add_option("-f", "--file", type="file", dest="file") def tearDown(self): - if os.path.isdir(test_support.TESTFN): - os.rmdir(test_support.TESTFN) - elif os.path.isfile(test_support.TESTFN): - os.unlink(test_support.TESTFN) + if os.path.isdir(support.TESTFN): + os.rmdir(support.TESTFN) + elif os.path.isfile(support.TESTFN): + os.unlink(support.TESTFN) class MyOption (Option): def check_file(option, opt, value): @@ -1038,21 +1038,21 @@ TYPE_CHECKER["file"] = check_file def test_filetype_ok(self): - open(test_support.TESTFN, "w").close() - self.assertParseOK(["--file", test_support.TESTFN, "-afoo"], - {'file': test_support.TESTFN, 'a': 'foo'}, + open(support.TESTFN, "w").close() + self.assertParseOK(["--file", support.TESTFN, "-afoo"], + {'file': support.TESTFN, 'a': 'foo'}, []) def test_filetype_noexist(self): - self.assertParseFail(["--file", test_support.TESTFN, "-afoo"], + self.assertParseFail(["--file", support.TESTFN, "-afoo"], "%s: file does not exist" % - test_support.TESTFN) + support.TESTFN) def test_filetype_notfile(self): - os.mkdir(test_support.TESTFN) - self.assertParseFail(["--file", test_support.TESTFN, "-afoo"], + os.mkdir(support.TESTFN) + self.assertParseFail(["--file", support.TESTFN, "-afoo"], "%s: not a regular file" % - test_support.TESTFN) + support.TESTFN) class TestExtendAddActions(BaseTest): @@ -1631,7 +1631,7 @@ def test_main(): - test_support.run_unittest(__name__) + support.run_unittest(__name__) if __name__ == '__main__': test_main() Index: Lib/test/test_cl.py =================================================================== --- Lib/test/test_cl.py (revision 62290) +++ Lib/test/test_cl.py (working copy) @@ -3,7 +3,7 @@ Roger E. Masse """ import cl -from test.test_support import verbose +from test.support import verbose clattrs = ['ADDED_ALGORITHM_ERROR', 'ALAW', 'ALGORITHM_ID', 'ALGORITHM_VERSION', 'AUDIO', 'AWARE_ERROR', 'AWARE_MPEG_AUDIO', Index: Lib/test/regrtest.py =================================================================== --- Lib/test/regrtest.py (revision 62290) +++ Lib/test/regrtest.py (working copy) @@ -163,7 +163,7 @@ newsoft = min(hard, max(soft, 1024*2048)) resource.setrlimit(resource.RLIMIT_STACK, (newsoft, hard)) -from test import test_support +from test import support RESOURCE_NAMES = ('audio', 'curses', 'largefile', 'network', 'bsddb', 'decimal', 'compiler', 'subprocess', 'urlfetch') @@ -201,7 +201,7 @@ values that would normally be set by flags on the command line. """ - test_support.record_original_stdout(sys.stdout) + support.record_original_stdout(sys.stdout) try: opts, args = getopt.getopt(sys.argv[1:], 'hvgqxsSrf:lu:t:TD:NLR:wM:', ['help', 'verbose', 'quiet', 'exclude', @@ -265,7 +265,7 @@ if len(huntrleaks[2]) == 0: huntrleaks[2] = "reflog.txt" elif o in ('-M', '--memlimit'): - test_support.set_memlimit(a) + support.set_memlimit(a) elif o in ('-u', '--use'): u = [x.lower() for x in a.split(',')] for r in u: @@ -348,8 +348,8 @@ tracer = trace.Trace(ignoredirs=[sys.prefix, sys.exec_prefix], trace=False, count=True) test_times = [] - test_support.verbose = verbose # Tell tests to be moderately quiet - test_support.use_resources = use_resources + support.verbose = verbose # Tell tests to be moderately quiet + support.use_resources = use_resources save_modules = sys.modules.keys() for test in tests: if not quiet: @@ -391,7 +391,7 @@ # Unload the newly imported modules (best effort finalization) for module in sys.modules.keys(): if module not in save_modules and module.startswith("test."): - test_support.unload(module) + support.unload(module) # The lists won't be sorted if running with -r good.sort() @@ -434,7 +434,7 @@ print "Re-running test %r in verbose mode" % test sys.stdout.flush() try: - test_support.verbose = True + support.verbose = True ok = runtest(test, True, quiet, test_times, testdir, huntrleaks) except KeyboardInterrupt: @@ -481,7 +481,6 @@ ] NOTTESTS = [ - 'test_support', 'test_future1', 'test_future2', ] @@ -525,7 +524,7 @@ def runtest_inner(test, verbose, quiet, test_times, testdir=None, huntrleaks=False): - test_support.unload(test) + support.unload(test) if not testdir: testdir = findtestdir() if verbose: @@ -558,19 +557,19 @@ test_times.append((test_time, test)) finally: sys.stdout = save_stdout - except test_support.ResourceDenied, msg: + except support.ResourceDenied, msg: if not quiet: print test, "skipped --", msg sys.stdout.flush() return -2 - except (ImportError, test_support.TestSkipped), msg: + except (ImportError, support.TestSkipped), msg: if not quiet: print test, "skipped --", msg sys.stdout.flush() return -1 except KeyboardInterrupt: raise - except test_support.TestFailed, msg: + except support.TestFailed, msg: print "test", test, "failed --", msg sys.stdout.flush() return 0 @@ -605,7 +604,7 @@ # since if a test leaves a file open, it cannot be deleted by name (while # there's nothing we can do about that here either, we can display the # name of the offending test, which is a real help). - for name in (test_support.TESTFN, + for name in (support.TESTFN, "db_home", ): if not os.path.exists(name): @@ -1168,10 +1167,10 @@ if __name__ == '__main__': # Remove regrtest.py's own directory from the module search path. This # prevents relative imports from working, and relative imports will screw - # up the testing framework. E.g. if both test.test_support and - # test_support are imported, they will not contain the same globals, and + # up the testing framework. E.g. if both test.support and + # support are imported, they will not contain the same globals, and # much of the testing framework relies on the globals in the - # test.test_support module. + # test.support module. mydir = os.path.abspath(os.path.normpath(os.path.dirname(sys.argv[0]))) i = pathlen = len(sys.path) while i >= 0: Index: Lib/test/test_codecs.py =================================================================== --- Lib/test/test_codecs.py (revision 62290) +++ Lib/test/test_codecs.py (working copy) @@ -1,4 +1,4 @@ -from test import test_support +from test import support import unittest import codecs import sys, StringIO, _testcapi @@ -973,7 +973,7 @@ try: self.assertEquals(nameprep(orig), prepped) except Exception,e: - raise test_support.TestFailed("Test 3.%d: %s" % (pos+1, str(e))) + raise support.TestFailed("Test 3.%d: %s" % (pos+1, str(e))) class IDNACodecTest(unittest.TestCase): def test_builtin_decode(self): @@ -1462,7 +1462,7 @@ def test_main(): - test_support.run_unittest( + support.run_unittest( UTF32Test, UTF32LETest, UTF32BETest, Index: Lib/test/test_gl.py =================================================================== --- Lib/test/test_gl.py (revision 62290) +++ Lib/test/test_gl.py (working copy) @@ -3,7 +3,7 @@ taken mostly from the documentation. Roger E. Masse """ -from test.test_support import verbose, TestSkipped +from test.support import verbose, TestSkipped import gl, GL, time glattrs = ['RGBcolor', 'RGBcursor', 'RGBmode', 'RGBrange', 'RGBwritemask', Index: Lib/test/test_robotparser.py =================================================================== --- Lib/test/test_robotparser.py (revision 62290) +++ Lib/test/test_robotparser.py (working copy) @@ -1,5 +1,5 @@ import unittest, StringIO, robotparser -from test import test_support +from test import support class RobotTestCase(unittest.TestCase): def __init__(self, index, parser, url, good, agent): @@ -136,7 +136,7 @@ class TestCase(unittest.TestCase): def runTest(self): - test_support.requires('network') + support.requires('network') # whole site is password-protected. url = 'http://mueblesmoraleda.com' parser = robotparser.RobotFileParser() @@ -145,9 +145,9 @@ self.assertEqual(parser.can_fetch("*", url+"/robots.txt"), False) def test_main(): - test_support.run_unittest(tests) + support.run_unittest(tests) TestCase().run() if __name__=='__main__': - test_support.Verbose = 1 + support.Verbose = 1 test_main() Index: Lib/test/test_xmlrpc.py =================================================================== --- Lib/test/test_xmlrpc.py (revision 62290) +++ Lib/test/test_xmlrpc.py (working copy) @@ -10,7 +10,7 @@ import httplib import socket import os -from test import test_support +from test import support try: unicode @@ -575,20 +575,20 @@ # if the method is GET and no request_text is given, it runs handle_get # get sysout output tmp = sys.stdout - sys.stdout = open(test_support.TESTFN, "w") + sys.stdout = open(support.TESTFN, "w") self.cgi.handle_request() sys.stdout.close() sys.stdout = tmp # parse Status header - handle = open(test_support.TESTFN, "r").read() + handle = open(support.TESTFN, "r").read() status = handle.split()[1] message = ' '.join(handle.split()[2:4]) self.assertEqual(status, '400') self.assertEqual(message, 'Bad Request') - os.remove(test_support.TESTFN) + os.remove(support.TESTFN) os.environ['REQUEST_METHOD'] = '' def test_cgi_xmlrpc_response(self): @@ -610,7 +610,7 @@ tmp2 = sys.stdout sys.stdin = open("xmldata.txt", "r") - sys.stdout = open(test_support.TESTFN, "w") + sys.stdout = open(support.TESTFN, "w") self.cgi.handle_request() @@ -620,13 +620,13 @@ sys.stdout = tmp2 # will respond exception, if so, our goal is achieved ;) - handle = open(test_support.TESTFN, "r").read() + handle = open(support.TESTFN, "r").read() # start with 44th char so as not to get http header, we just need only xml self.assertRaises(xmlrpclib.Fault, xmlrpclib.loads, handle[44:]) os.remove("xmldata.txt") - os.remove(test_support.TESTFN) + os.remove(support.TESTFN) def test_main(): xmlrpc_tests = [XMLRPCTestCase, HelperTestCase, DateTimeTestCase, @@ -641,7 +641,7 @@ xmlrpc_tests.append(FailingServerTestCase) xmlrpc_tests.append(CGIHandlerTestCase) - test_support.run_unittest(*xmlrpc_tests) + support.run_unittest(*xmlrpc_tests) if __name__ == "__main__": test_main() Index: Lib/test/test_pickle.py =================================================================== --- Lib/test/test_pickle.py (revision 62290) +++ Lib/test/test_pickle.py (working copy) @@ -1,7 +1,7 @@ import pickle from cStringIO import StringIO -from test import test_support +from test import support from test.pickletester import AbstractPickleTests from test.pickletester import AbstractPickleModuleTests @@ -61,12 +61,12 @@ return u.load() def test_main(): - test_support.run_unittest( + support.run_unittest( PickleTests, PicklerTests, PersPicklerTests ) - test_support.run_doctest(pickle) + support.run_doctest(pickle) if __name__ == "__main__": test_main() Index: Lib/test/test_repr.py =================================================================== --- Lib/test/test_repr.py (revision 62290) +++ Lib/test/test_repr.py (working copy) @@ -8,7 +8,7 @@ import shutil import unittest -from test.test_support import run_unittest +from test.support import run_unittest from repr import repr as r # Don't shadow builtin repr from repr import Repr Index: Lib/test/test_code.py =================================================================== --- Lib/test/test_code.py (revision 62290) +++ Lib/test/test_code.py (working copy) @@ -97,7 +97,7 @@ print "consts:", tuple(consts(co.co_consts)) def test_main(verbose=None): - from test.test_support import run_doctest + from test.support import run_doctest from test import test_code run_doctest(test_code, verbose) Index: Lib/test/test_pkgimport.py =================================================================== --- Lib/test/test_pkgimport.py (revision 62290) +++ Lib/test/test_pkgimport.py (working copy) @@ -1,6 +1,6 @@ import os, sys, string, random, tempfile, unittest -from test.test_support import run_unittest +from test.support import run_unittest class TestImport(unittest.TestCase): Index: Lib/test/test_binhex.py =================================================================== --- Lib/test/test_binhex.py (revision 62290) +++ Lib/test/test_binhex.py (working copy) @@ -7,14 +7,14 @@ import binhex import os import unittest -from test import test_support +from test import support class BinHexTestCase(unittest.TestCase): def setUp(self): - self.fname1 = test_support.TESTFN + "1" - self.fname2 = test_support.TESTFN + "2" + self.fname1 = support.TESTFN + "1" + self.fname2 = support.TESTFN + "2" def tearDown(self): try: os.unlink(self.fname1) @@ -42,7 +42,7 @@ def test_main(): - test_support.run_unittest(BinHexTestCase) + support.run_unittest(BinHexTestCase) if __name__ == "__main__": Index: Lib/test/test_fpformat.py =================================================================== --- Lib/test/test_fpformat.py (revision 62290) +++ Lib/test/test_fpformat.py (working copy) @@ -2,7 +2,7 @@ Tests for fpformat module Nick Mathewson ''' -from test.test_support import run_unittest +from test.support import run_unittest import unittest from fpformat import fix, sci, NotANumber Index: Lib/test/test_bsddb.py =================================================================== --- Lib/test/test_bsddb.py (revision 62290) +++ Lib/test/test_bsddb.py (working copy) @@ -7,7 +7,7 @@ import bsddb import dbhash # Just so we know it's imported import unittest -from test import test_support +from test import support class TestBSDDB(unittest.TestCase): openflag = 'c' @@ -276,7 +276,7 @@ self.assertEqual(list(self.f), keys) class TestBTree(TestBSDDB): - fname = test_support.TESTFN + fname = support.TESTFN openmethod = [bsddb.btopen] class TestBTree_InMemory(TestBSDDB): @@ -289,7 +289,7 @@ openmethod = [bsddb.btopen] class TestHashTable(TestBSDDB): - fname = test_support.TESTFN + fname = support.TESTFN openmethod = [bsddb.hashopen] class TestHashTable_InMemory(TestBSDDB): @@ -301,7 +301,7 @@ ## # Solaris Intel - rmasse 1/97 def test_main(verbose=None): - test_support.run_unittest( + support.run_unittest( TestBTree, TestHashTable, TestBTree_InMemory, Index: Lib/test/test_pep352.py =================================================================== --- Lib/test/test_pep352.py (revision 62290) +++ Lib/test/test_pep352.py (working copy) @@ -2,7 +2,7 @@ import __builtin__ import exceptions import warnings -from test.test_support import run_unittest, catch_warning +from test.support import run_unittest, catch_warning import os from platform import system as platform_system Index: Lib/test/test_linuxaudiodev.py =================================================================== --- Lib/test/test_linuxaudiodev.py (revision 62290) +++ Lib/test/test_linuxaudiodev.py (working copy) @@ -1,7 +1,7 @@ -from test import test_support -test_support.requires('audio') +from test import support +support.requires('audio') -from test.test_support import findfile, TestSkipped, run_unittest +from test.support import findfile, TestSkipped, run_unittest import errno import linuxaudiodev Index: Lib/test/test_symtable.py =================================================================== --- Lib/test/test_symtable.py (revision 62290) +++ Lib/test/test_symtable.py (working copy) @@ -1,4 +1,4 @@ -from test import test_support +from test import support import symtable import unittest @@ -38,7 +38,7 @@ def test_main(): - test_support.run_unittest(SymtableTest) + support.run_unittest(SymtableTest) if __name__ == '__main__': test_main() Index: Lib/test/test_exceptions.py =================================================================== --- Lib/test/test_exceptions.py (revision 62290) +++ Lib/test/test_exceptions.py (working copy) @@ -5,7 +5,7 @@ import unittest import pickle, cPickle -from test.test_support import (TESTFN, unlink, run_unittest, +from test.support import (TESTFN, unlink, run_unittest, catch_warning) from test.test_pep352 import ignore_message_warning Index: Lib/test/test_sundry.py =================================================================== --- Lib/test/test_sundry.py (revision 62290) +++ Lib/test/test_sundry.py (working copy) @@ -1,6 +1,6 @@ """Do a minimal test of all the modules that aren't otherwise tested.""" -from test import test_support +from test import support import sys import unittest import warnings @@ -8,7 +8,7 @@ class TestUntestedModules(unittest.TestCase): def test_at_least_import_untested_modules(self): - with test_support.catch_warning(): + with support.catch_warning(): import BaseHTTPServer import DocXMLRPCServer import CGIHTTPServer @@ -109,7 +109,7 @@ try: import tty # not available on Windows except ImportError: - if test_support.verbose: + if support.verbose: print "skipping tty" # Can't test the "user" module -- if the user has a ~/.pythonrc.py, it @@ -120,7 +120,7 @@ def test_main(): - test_support.run_unittest(TestUntestedModules) + support.run_unittest(TestUntestedModules) if __name__ == "__main__": test_main() Index: Lib/test/test_md5.py =================================================================== --- Lib/test/test_md5.py (revision 62290) +++ Lib/test/test_md5.py (working copy) @@ -5,7 +5,7 @@ import unittest from md5 import md5 -from test import test_support +from test import support def hexstr(s): import string @@ -55,7 +55,7 @@ self.assertEqual(m1.digest(), m2.digest()) def test_main(): - test_support.run_unittest(MD5_Test) + support.run_unittest(MD5_Test) if __name__ == '__main__': test_main() Index: Lib/test/test_univnewlines.py =================================================================== --- Lib/test/test_univnewlines.py (revision 62290) +++ Lib/test/test_univnewlines.py (working copy) @@ -2,10 +2,10 @@ import unittest import os import sys -from test import test_support +from test import support if not hasattr(sys.stdin, 'newlines'): - raise test_support.TestSkipped, \ + raise support.TestSkipped, \ "This Python does not have universal newline support" FATX = 'x' * (2**14) @@ -37,30 +37,30 @@ WRITEMODE = 'wb' def setUp(self): - fp = open(test_support.TESTFN, self.WRITEMODE) + fp = open(support.TESTFN, self.WRITEMODE) fp.write(self.DATA) fp.close() def tearDown(self): try: - os.unlink(test_support.TESTFN) + os.unlink(support.TESTFN) except: pass def test_read(self): - fp = open(test_support.TESTFN, self.READMODE) + fp = open(support.TESTFN, self.READMODE) data = fp.read() self.assertEqual(data, DATA_LF) self.assertEqual(repr(fp.newlines), repr(self.NEWLINE)) def test_readlines(self): - fp = open(test_support.TESTFN, self.READMODE) + fp = open(support.TESTFN, self.READMODE) data = fp.readlines() self.assertEqual(data, DATA_SPLIT) self.assertEqual(repr(fp.newlines), repr(self.NEWLINE)) def test_readline(self): - fp = open(test_support.TESTFN, self.READMODE) + fp = open(support.TESTFN, self.READMODE) data = [] d = fp.readline() while d: @@ -70,7 +70,7 @@ self.assertEqual(repr(fp.newlines), repr(self.NEWLINE)) def test_seek(self): - fp = open(test_support.TESTFN, self.READMODE) + fp = open(support.TESTFN, self.READMODE) fp.readline() pos = fp.tell() data = fp.readlines() @@ -81,7 +81,7 @@ def test_execfile(self): namespace = {} - execfile(test_support.TESTFN, namespace) + execfile(support.TESTFN, namespace) func = namespace['line3'] self.assertEqual(func.func_code.co_firstlineno, 3) self.assertEqual(namespace['line4'], FATX) @@ -106,7 +106,7 @@ DATA = DATA_CRLF def test_tell(self): - fp = open(test_support.TESTFN, self.READMODE) + fp = open(support.TESTFN, self.READMODE) self.assertEqual(repr(fp.newlines), repr(None)) data = fp.readline() pos = fp.tell() @@ -118,7 +118,7 @@ def test_main(): - test_support.run_unittest( + support.run_unittest( TestNativeNewlines, TestCRNewlines, TestLFNewlines, Index: Lib/test/test_tokenize.py =================================================================== --- Lib/test/test_tokenize.py (revision 62290) +++ Lib/test/test_tokenize.py (working copy) @@ -74,7 +74,7 @@ ... " print x\\n") True - >>> f = test_support.findfile("tokenize_tests" + os.extsep + "txt") + >>> f = support.findfile("tokenize_tests" + os.extsep + "txt") >>> roundtrip(open(f)) True @@ -499,7 +499,7 @@ >>> tempdir = os.path.dirname(f) or os.curdir >>> testfiles = glob.glob(os.path.join(tempdir, "test*.py")) - >>> if not test_support.is_resource_enabled("compiler"): + >>> if not support.is_resource_enabled("compiler"): ... testfiles = random.sample(testfiles, 10) ... >>> for testfile in testfiles: @@ -511,7 +511,7 @@ """ -from test import test_support +from test import support from tokenize import (tokenize, untokenize, generate_tokens, NUMBER, NAME, OP, STRING, ENDMARKER, tok_name) from StringIO import StringIO @@ -573,7 +573,7 @@ def test_main(): from test import test_tokenize - test_support.run_doctest(test_tokenize, True) + support.run_doctest(test_tokenize, True) if __name__ == "__main__": test_main() Index: Lib/test/test_warnings.py =================================================================== --- Lib/test/test_warnings.py (revision 62290) +++ Lib/test/test_warnings.py (working copy) @@ -4,7 +4,7 @@ import StringIO import sys import unittest -from test import test_support +from test import support import warning_tests @@ -14,7 +14,7 @@ if w[0]=='ignore' and w[1] is None and w[3] is None] def test_warn_default_category(self): - with test_support.catch_warning() as w: + with support.catch_warning() as w: for i in range(4): text = 'multi %d' %i # Different text on each call warnings.warn(text) @@ -22,7 +22,7 @@ self.assert_(w.category is UserWarning) def test_warn_specific_category(self): - with test_support.catch_warning() as w: + with support.catch_warning() as w: text = 'None' for category in [DeprecationWarning, FutureWarning, PendingDeprecationWarning, RuntimeWarning, @@ -40,7 +40,7 @@ def test_filtering(self): # Test filterwarnings(). # Implicitly also tests resetwarnings(). - with test_support.catch_warning() as w: + with support.catch_warning() as w: warnings.filterwarnings("error", "", Warning, "", 0) self.assertRaises(UserWarning, warnings.warn, 'convert to error') @@ -66,7 +66,7 @@ def test_options(self): # Uses the private _setoption() function to test the parsing # of command-line warning arguments - with test_support.catch_warning(): + with support.catch_warning(): self.assertRaises(warnings._OptionError, warnings._setoption, '1:2:3:4:5:6') self.assertRaises(warnings._OptionError, @@ -77,7 +77,7 @@ self.assertRaises(UserWarning, warnings.warn, 'convert to error') def test_filename(self): - with test_support.catch_warning() as w: + with support.catch_warning() as w: warning_tests.inner("spam1") self.assertEqual(os.path.basename(w.filename), "warning_tests.py") warning_tests.outer("spam2") @@ -86,7 +86,7 @@ def test_stacklevel(self): # Test stacklevel argument # make sure all messages are different, so the warning won't be skipped - with test_support.catch_warning() as w: + with support.catch_warning() as w: warning_tests.inner("spam3", stacklevel=1) self.assertEqual(os.path.basename(w.filename), "warning_tests.py") warning_tests.outer("spam4", stacklevel=1) @@ -137,7 +137,7 @@ del warning_tests.__warningregistry__ if hasattr(sys, '__warningregistry__'): del sys.__warningregistry__ - test_support.run_unittest(TestModule, WarningsDisplayTests) + support.run_unittest(TestModule, WarningsDisplayTests) if __name__ == "__main__": test_main(verbose=True) Index: Lib/test/test_tuple.py =================================================================== --- Lib/test/test_tuple.py (revision 62290) +++ Lib/test/test_tuple.py (working copy) @@ -1,4 +1,4 @@ -from test import test_support, seq_tests +from test import support, seq_tests class TupleTest(seq_tests.CommonTest): type2test = tuple @@ -76,7 +76,7 @@ self.assertEqual(repr(a2), "(0, 1, 2)") def test_main(): - test_support.run_unittest(TupleTest) + support.run_unittest(TupleTest) if __name__=="__main__": test_main() Index: Lib/test/test_descrtut.py =================================================================== --- Lib/test/test_descrtut.py (revision 62290) +++ Lib/test/test_descrtut.py (working copy) @@ -8,7 +8,7 @@ # of much interest anymore), and a few were fiddled to make the output # deterministic. -from test.test_support import sortdict +from test.support import sortdict import pprint class defaultdict(dict): @@ -488,8 +488,8 @@ # into the doctest examples, and unless the full test.test_descrtut # business is used the name can change depending on how the test is # invoked. - from test import test_support, test_descrtut - test_support.run_doctest(test_descrtut, verbose) + from test import support, test_descrtut + support.run_doctest(test_descrtut, verbose) # This part isn't needed for regrtest, but for running the test directly. if __name__ == "__main__": Index: Lib/test/test__locale.py =================================================================== --- Lib/test/test__locale.py (revision 62290) +++ Lib/test/test__locale.py (working copy) @@ -1,4 +1,4 @@ -from test.test_support import verbose, TestSkipped, run_unittest +from test.support import verbose, TestSkipped, run_unittest from _locale import (setlocale, LC_NUMERIC, RADIXCHAR, THOUSEP, nl_langinfo, localeconv, Error) import unittest Index: Lib/test/test_global.py =================================================================== --- Lib/test/test_global.py (revision 62290) +++ Lib/test/test_global.py (working copy) @@ -1,6 +1,6 @@ """Verify that warnings are issued for global statements following use.""" -from test.test_support import run_unittest, check_syntax_error +from test.support import run_unittest, check_syntax_error import unittest import warnings Index: Lib/test/test_mutex.py =================================================================== --- Lib/test/test_mutex.py (revision 62290) +++ Lib/test/test_mutex.py (working copy) @@ -1,7 +1,7 @@ import mutex import unittest -import test.test_support +import test.support class MutexTest(unittest.TestCase): @@ -27,7 +27,7 @@ self.failIf(self.mutex.test(), "mutex still held") def test_main(): - test.test_support.run_unittest(MutexTest) + test.support.run_unittest(MutexTest) if __name__ == "__main__": test_main() Index: Lib/test/test_cmd.py =================================================================== --- Lib/test/test_cmd.py (revision 62290) +++ Lib/test/test_cmd.py (working copy) @@ -166,8 +166,8 @@ return True def test_main(verbose=None): - from test import test_support, test_cmd - test_support.run_doctest(test_cmd, verbose) + from test import support, test_cmd + support.run_doctest(test_cmd, verbose) import trace, sys def test_coverage(coverdir): Index: Lib/test/test_io.py =================================================================== --- Lib/test/test_io.py (revision 62290) +++ Lib/test/test_io.py (working copy) @@ -8,7 +8,7 @@ import array import unittest from itertools import chain -from test import test_support +from test import support import codecs import io # The module under test @@ -82,7 +82,7 @@ class IOTest(unittest.TestCase): def tearDown(self): - test_support.unlink(test_support.TESTFN) + support.unlink(support.TESTFN) def write_ops(self, f): self.assertEqual(f.write(b"blah."), 5) @@ -148,13 +148,13 @@ self.assertEqual(f.read(2), b"x") def test_raw_file_io(self): - f = io.open(test_support.TESTFN, "wb", buffering=0) + f = io.open(support.TESTFN, "wb", buffering=0) self.assertEqual(f.readable(), False) self.assertEqual(f.writable(), True) self.assertEqual(f.seekable(), True) self.write_ops(f) f.close() - f = io.open(test_support.TESTFN, "rb", buffering=0) + f = io.open(support.TESTFN, "rb", buffering=0) self.assertEqual(f.readable(), True) self.assertEqual(f.writable(), False) self.assertEqual(f.seekable(), True) @@ -162,13 +162,13 @@ f.close() def test_buffered_file_io(self): - f = io.open(test_support.TESTFN, "wb") + f = io.open(support.TESTFN, "wb") self.assertEqual(f.readable(), False) self.assertEqual(f.writable(), True) self.assertEqual(f.seekable(), True) self.write_ops(f) f.close() - f = io.open(test_support.TESTFN, "rb") + f = io.open(support.TESTFN, "rb") self.assertEqual(f.readable(), True) self.assertEqual(f.writable(), False) self.assertEqual(f.seekable(), True) @@ -176,10 +176,10 @@ f.close() def test_readline(self): - f = io.open(test_support.TESTFN, "wb") + f = io.open(support.TESTFN, "wb") f.write(b"abc\ndef\nxyzzy\nfoo") f.close() - f = io.open(test_support.TESTFN, "rb") + f = io.open(support.TESTFN, "rb") self.assertEqual(f.readline(), b"abc\n") self.assertEqual(f.readline(10), b"def\n") self.assertEqual(f.readline(2), b"xy") @@ -200,7 +200,7 @@ # a long time to build the >2GB file and takes >2GB of disk space # therefore the resource must be enabled to run this test. if sys.platform[:3] == 'win' or sys.platform == 'darwin': - if not test_support.is_resource_enabled("largefile"): + if not support.is_resource_enabled("largefile"): print("\nTesting large file ops skipped on %s." % sys.platform, file=sys.stderr) print("It requires %d bytes and a long time." % self.LARGE, @@ -208,22 +208,22 @@ print("Use 'regrtest.py -u largefile test_io' to run it.", file=sys.stderr) return - f = io.open(test_support.TESTFN, "w+b", 0) + f = io.open(support.TESTFN, "w+b", 0) self.large_file_ops(f) f.close() - f = io.open(test_support.TESTFN, "w+b") + f = io.open(support.TESTFN, "w+b") self.large_file_ops(f) f.close() def test_with_open(self): for bufsize in (0, 1, 100): f = None - with open(test_support.TESTFN, "wb", bufsize) as f: + with open(support.TESTFN, "wb", bufsize) as f: f.write(b"xxx") self.assertEqual(f.closed, True) f = None try: - with open(test_support.TESTFN, "wb", bufsize) as f: + with open(support.TESTFN, "wb", bufsize) as f: 1/0 except ZeroDivisionError: self.assertEqual(f.closed, True) @@ -242,16 +242,16 @@ def flush(self): record.append(3) io.FileIO.flush(self) - f = MyFileIO(test_support.TESTFN, "w") + f = MyFileIO(support.TESTFN, "w") f.write("xxx") del f self.assertEqual(record, [1, 2, 3]) def test_close_flushes(self): - f = io.open(test_support.TESTFN, "wb") + f = io.open(support.TESTFN, "wb") f.write(b"xxx") f.close() - f = io.open(test_support.TESTFN, "rb") + f = io.open(support.TESTFN, "rb") self.assertEqual(f.read(), b"xxx") f.close() @@ -259,15 +259,15 @@ # XXX memory view not available yet a = array.array('i', range(10)) n = len(memoryview(a)) - f = io.open(test_support.TESTFN, "wb", 0) + f = io.open(support.TESTFN, "wb", 0) self.assertEqual(f.write(a), n) f.close() - f = io.open(test_support.TESTFN, "wb") + f = io.open(support.TESTFN, "wb") self.assertEqual(f.write(a), n) f.close() def test_closefd(self): - self.assertRaises(ValueError, io.open, test_support.TESTFN, 'w', + self.assertRaises(ValueError, io.open, support.TESTFN, 'w', closefd=False) class MemorySeekTestMixin: @@ -640,7 +640,7 @@ self.normalized = b"AAA\nBBB\nCCC\nDDD\nEEE\n".decode("ascii") def tearDown(self): - test_support.unlink(test_support.TESTFN) + support.unlink(support.TESTFN) def testLineBuffering(self): r = io.BytesIO() @@ -815,11 +815,11 @@ def testBasicIO(self): for chunksize in (1, 2, 3, 4, 5, 15, 16, 17, 31, 32, 33, 63, 64, 65): for enc in "ascii", "latin1", "utf8" :# , "utf-16-be", "utf-16-le": - f = io.open(test_support.TESTFN, "w+", encoding=enc) + f = io.open(support.TESTFN, "w+", encoding=enc) f._CHUNK_SIZE = chunksize self.assertEquals(f.write(u"abc"), 3) f.close() - f = io.open(test_support.TESTFN, "r+", encoding=enc) + f = io.open(support.TESTFN, "r+", encoding=enc) f._CHUNK_SIZE = chunksize self.assertEquals(f.tell(), 0) self.assertEquals(f.read(), u"abc") @@ -862,7 +862,7 @@ self.assertEquals(rlines, wlines) def testTelling(self): - f = io.open(test_support.TESTFN, "w+", encoding="utf8") + f = io.open(support.TESTFN, "w+", encoding="utf8") p0 = f.tell() f.write(u"\xff\n") p1 = f.tell() @@ -890,10 +890,10 @@ u_suffix = "\u8888\n" suffix = bytes(u_suffix.encode("utf-8")) line = prefix + suffix - f = io.open(test_support.TESTFN, "wb") + f = io.open(support.TESTFN, "wb") f.write(line*2) f.close() - f = io.open(test_support.TESTFN, "r", encoding="utf-8") + f = io.open(support.TESTFN, "r", encoding="utf-8") s = f.read(prefix_size) self.assertEquals(s, unicode(prefix, "ascii")) self.assertEquals(f.tell(), prefix_size) @@ -902,10 +902,10 @@ def testSeekingToo(self): # Regression test for a specific bug data = b'\xe0\xbf\xbf\n' - f = io.open(test_support.TESTFN, "wb") + f = io.open(support.TESTFN, "wb") f.write(data) f.close() - f = io.open(test_support.TESTFN, "r", encoding="utf-8") + f = io.open(support.TESTFN, "r", encoding="utf-8") f._CHUNK_SIZE # Just test that it exists f._CHUNK_SIZE = 2 f.readline() @@ -917,16 +917,16 @@ def testSeekAndTellWithData(data, min_pos=0): """Tell/seek to various points within a data stream and ensure that the decoded data returned by read() is consistent.""" - f = io.open(test_support.TESTFN, 'wb') + f = io.open(support.TESTFN, 'wb') f.write(data) f.close() - f = io.open(test_support.TESTFN, encoding='test_decoder') + f = io.open(support.TESTFN, encoding='test_decoder') decoded = f.read() f.close() for i in range(min_pos, len(decoded) + 1): # seek positions for j in [1, 5, len(decoded) - i]: # read lengths - f = io.open(test_support.TESTFN, encoding='test_decoder') + f = io.open(support.TESTFN, encoding='test_decoder') self.assertEquals(f.read(i), decoded[:i]) cookie = f.tell() self.assertEquals(f.read(j), decoded[i:i + j]) @@ -982,7 +982,7 @@ nchars = len(line) nbytes = len(line.encode(enc)) for chunk_size in (32, 64, 128, 256): - f = io.open(test_support.TESTFN, "w+", encoding=enc) + f = io.open(support.TESTFN, "w+", encoding=enc) f._CHUNK_SIZE = chunk_size t0 = timer() for i in range(nlines): @@ -1002,7 +1002,7 @@ f.tell() t4 = timer() f.close() - if test_support.verbose: + if support.verbose: print("\nTiming test: %d lines of %d characters (%d bytes)" % (nlines, nchars, nbytes)) print("File chunk size: %6s" % f._CHUNK_SIZE) @@ -1159,7 +1159,7 @@ def test_main(): - test_support.run_unittest(IOTest, BytesIOTest, StringIOTest, + support.run_unittest(IOTest, BytesIOTest, StringIOTest, BufferedReaderTest, BufferedWriterTest, BufferedRWPairTest, BufferedRandomTest, TextIOWrapperTest, Index: Lib/test/test_ctypes.py =================================================================== --- Lib/test/test_ctypes.py (revision 62290) +++ Lib/test/test_ctypes.py (working copy) @@ -1,6 +1,6 @@ import unittest -from test.test_support import run_unittest +from test.support import run_unittest import ctypes.test def test_main(): Index: Lib/test/test_mimetools.py =================================================================== --- Lib/test/test_mimetools.py (revision 62290) +++ Lib/test/test_mimetools.py (working copy) @@ -1,5 +1,5 @@ import unittest -from test import test_support +from test import support import string, StringIO, mimetools @@ -44,7 +44,7 @@ self.assertEqual(msg.getencoding(), "8bit") def test_main(): - test_support.run_unittest(MimeToolsTest) + support.run_unittest(MimeToolsTest) if __name__=="__main__": test_main() Index: Lib/test/test_gdbm.py =================================================================== --- Lib/test/test_gdbm.py (revision 62290) +++ Lib/test/test_gdbm.py (working copy) @@ -1,7 +1,7 @@ import gdbm import unittest import os -from test.test_support import verbose, TESTFN, run_unittest, unlink +from test.support import verbose, TESTFN, run_unittest, unlink filename = TESTFN Index: Lib/test/test_dumbdbm.py =================================================================== --- Lib/test/test_dumbdbm.py (revision 62290) +++ Lib/test/test_dumbdbm.py (working copy) @@ -6,9 +6,9 @@ import os import unittest import dumbdbm -from test import test_support +from test import support -_fname = test_support.TESTFN +_fname = support.TESTFN def _delete_files(): for ext in [".dir", ".dat", ".bak"]: @@ -171,7 +171,7 @@ def test_main(): try: - test_support.run_unittest(DumbDBMTestCase) + support.run_unittest(DumbDBMTestCase) finally: _delete_files() Index: Lib/test/test_smtplib.py =================================================================== --- Lib/test/test_smtplib.py (revision 62290) +++ Lib/test/test_smtplib.py (working copy) @@ -10,9 +10,9 @@ import select from unittest import TestCase -from test import test_support +from test import support -HOST = test_support.HOST +HOST = support.HOST def server(evt, buf, serv): serv.listen(5) @@ -42,7 +42,7 @@ self.evt = threading.Event() self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.sock.settimeout(15) - self.port = test_support.bind_port(self.sock) + self.port = support.bind_port(self.sock) servargs = (self.evt, "220 Hola mundo\n", self.sock) threading.Thread(target=server, args=servargs).start() self.evt.wait() @@ -142,7 +142,7 @@ self.serv_evt = threading.Event() self.client_evt = threading.Event() - self.port = test_support.find_unused_port() + self.port = support.find_unused_port() self.serv = smtpd.DebuggingServer((HOST, self.port), ('nowhere', -1)) serv_args = (self.serv, self.serv_evt, self.client_evt) threading.Thread(target=debugging_server, args=serv_args).start() @@ -250,7 +250,7 @@ self.evt = threading.Event() self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.sock.settimeout(15) - self.port = test_support.bind_port(self.sock) + self.port = support.bind_port(self.sock) servargs = (self.evt, "199 no hello for you!\n", self.sock) threading.Thread(target=server, args=servargs).start() self.evt.wait() @@ -327,7 +327,7 @@ def setUp(self): self.serv_evt = threading.Event() self.client_evt = threading.Event() - self.port = test_support.find_unused_port() + self.port = support.find_unused_port() self.serv = SimSMTPServer((HOST, self.port), ('nowhere', -1)) serv_args = (self.serv, self.serv_evt, self.client_evt) threading.Thread(target=debugging_server, args=serv_args).start() @@ -398,7 +398,7 @@ def test_main(verbose=None): - test_support.run_unittest(GeneralTests, DebuggingServerTests, + support.run_unittest(GeneralTests, DebuggingServerTests, NonConnectingTests, BadHELOServerTests, SMTPSimTests) Index: Lib/test/test_imaplib.py =================================================================== --- Lib/test/test_imaplib.py (revision 62290) +++ Lib/test/test_imaplib.py (working copy) @@ -1,7 +1,7 @@ import imaplib import time -from test import test_support +from test import support import unittest @@ -18,7 +18,7 @@ def test_main(): - test_support.run_unittest(TestImaplib) + support.run_unittest(TestImaplib) if __name__ == "__main__": Index: Lib/test/test_importhooks.py =================================================================== --- Lib/test/test_importhooks.py (revision 62290) +++ Lib/test/test_importhooks.py (working copy) @@ -2,7 +2,7 @@ import imp import os import unittest -from test import test_support +from test import support test_src = """\ @@ -270,7 +270,7 @@ pass def test_main(): - test_support.run_unittest(ImportHooksTestCase) + support.run_unittest(ImportHooksTestCase) if __name__ == "__main__": test_main() Index: Lib/test/test_traceback.py =================================================================== --- Lib/test/test_traceback.py (revision 62290) +++ Lib/test/test_traceback.py (working copy) @@ -1,7 +1,7 @@ """Test cases for traceback module""" import unittest -from test.test_support import run_unittest, is_jython +from test.support import run_unittest, is_jython import traceback Index: Lib/test/test_macostools.py =================================================================== --- Lib/test/test_macostools.py (revision 62290) +++ Lib/test/test_macostools.py (working copy) @@ -6,23 +6,23 @@ import MacOS import os import sys -from test import test_support +from test import support -TESTFN2 = test_support.TESTFN + '2' +TESTFN2 = support.TESTFN + '2' class TestMacostools(unittest.TestCase): def setUp(self): - fp = open(test_support.TESTFN, 'w') + fp = open(support.TESTFN, 'w') fp.write('hello world\n') fp.close() - rfp = MacOS.openrf(test_support.TESTFN, '*wb') + rfp = MacOS.openrf(support.TESTFN, '*wb') rfp.write('goodbye world\n') rfp.close() def tearDown(self): try: - os.unlink(test_support.TESTFN) + os.unlink(support.TESTFN) except: pass try: @@ -31,7 +31,7 @@ pass def compareData(self): - fp = open(test_support.TESTFN, 'r') + fp = open(support.TESTFN, 'r') data1 = fp.read() fp.close() fp = open(TESTFN2, 'r') @@ -39,7 +39,7 @@ fp.close() if data1 != data2: return 'Data forks differ' - rfp = MacOS.openrf(test_support.TESTFN, '*rb') + rfp = MacOS.openrf(support.TESTFN, '*rb') data1 = rfp.read(1000) rfp.close() rfp = MacOS.openrf(TESTFN2, '*rb') @@ -52,17 +52,17 @@ def test_touched(self): # This really only tests that nothing unforeseen happens. import warnings - with test_support.catch_warning(): + with support.catch_warning(): warnings.filterwarnings('ignore', 'macostools.touched*', DeprecationWarning) - macostools.touched(test_support.TESTFN) + macostools.touched(support.TESTFN) def test_copy(self): try: os.unlink(TESTFN2) except: pass - macostools.copy(test_support.TESTFN, TESTFN2) + macostools.copy(support.TESTFN, TESTFN2) self.assertEqual(self.compareData(), '') def test_mkalias(self): @@ -70,9 +70,9 @@ os.unlink(TESTFN2) except: pass - macostools.mkalias(test_support.TESTFN, TESTFN2) + macostools.mkalias(support.TESTFN, TESTFN2) fss, _, _ = Carbon.File.ResolveAliasFile(TESTFN2, 0) - self.assertEqual(fss.as_pathname(), os.path.realpath(test_support.TESTFN)) + self.assertEqual(fss.as_pathname(), os.path.realpath(support.TESTFN)) def test_mkalias_relative(self): try: @@ -85,13 +85,13 @@ # leave it with the proper permissions. if not os.path.exists(sys.prefix): return - macostools.mkalias(test_support.TESTFN, TESTFN2, sys.prefix) + macostools.mkalias(support.TESTFN, TESTFN2, sys.prefix) fss, _, _ = Carbon.File.ResolveAliasFile(TESTFN2, 0) - self.assertEqual(fss.as_pathname(), os.path.realpath(test_support.TESTFN)) + self.assertEqual(fss.as_pathname(), os.path.realpath(support.TESTFN)) def test_main(): - test_support.run_unittest(TestMacostools) + support.run_unittest(TestMacostools) if __name__ == '__main__': Index: Lib/test/test_dict.py =================================================================== --- Lib/test/test_dict.py (revision 62290) +++ Lib/test/test_dict.py (working copy) @@ -1,5 +1,5 @@ import unittest -from test import test_support +from test import support import UserDict, random, string @@ -557,7 +557,7 @@ type2test = Dict def test_main(): - test_support.run_unittest( + support.run_unittest( DictTest, GeneralMappingTests, SubclassMappingTests, Index: Lib/test/test_asyncore.py =================================================================== --- Lib/test/test_asyncore.py (revision 62290) +++ Lib/test/test_asyncore.py (working copy) @@ -7,11 +7,11 @@ import sys import time -from test import test_support -from test.test_support import TESTFN, run_unittest, unlink +from test import support +from test.support import TESTFN, run_unittest, unlink from StringIO import StringIO -HOST = test_support.HOST +HOST = support.HOST class dummysocket: def __init__(self): @@ -333,7 +333,7 @@ self.evt = threading.Event() self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.sock.settimeout(3) - self.port = test_support.bind_port(self.sock) + self.port = support.bind_port(self.sock) cap = StringIO() args = (self.evt, cap, self.sock) Index: Lib/test/test_ucn.py =================================================================== --- Lib/test/test_ucn.py (revision 62290) +++ Lib/test/test_ucn.py (working copy) @@ -9,7 +9,7 @@ import unittest -from test import test_support +from test import support class UnicodeNamesTest(unittest.TestCase): @@ -138,7 +138,7 @@ ) def test_main(): - test_support.run_unittest(UnicodeNamesTest) + support.run_unittest(UnicodeNamesTest) if __name__ == "__main__": test_main() Index: Lib/test/test_new.py =================================================================== --- Lib/test/test_new.py (revision 62290) +++ Lib/test/test_new.py (working copy) @@ -1,5 +1,5 @@ import unittest -from test import test_support +from test import support import sys, new class NewTest(unittest.TestCase): @@ -156,7 +156,7 @@ self.assert_(type(t[0]) is S, "eek, tuple changed under us!") def test_main(): - test_support.run_unittest(NewTest) + support.run_unittest(NewTest) if __name__ == "__main__": test_main() Index: Lib/test/test_set.py =================================================================== --- Lib/test/test_set.py (revision 62290) +++ Lib/test/test_set.py (working copy) @@ -1,5 +1,5 @@ import unittest -from test import test_support +from test import support from weakref import proxy import operator import copy @@ -283,15 +283,15 @@ w = ReprWrapper() s = self.thetype([w]) w.value = s - fo = open(test_support.TESTFN, "wb") + fo = open(support.TESTFN, "wb") try: print >> fo, s, fo.close() - fo = open(test_support.TESTFN, "rb") + fo = open(support.TESTFN, "rb") self.assertEqual(fo.read(), repr(s)) finally: fo.close() - test_support.unlink(test_support.TESTFN) + support.unlink(support.TESTFN) def test_do_not_rehash_dict_keys(self): n = 10 @@ -626,15 +626,15 @@ self.assertEqual(repr(self.set), self.repr) def test_print(self): - fo = open(test_support.TESTFN, "wb") + fo = open(support.TESTFN, "wb") try: print >> fo, self.set, fo.close() - fo = open(test_support.TESTFN, "rb") + fo = open(support.TESTFN, "rb") self.assertEqual(fo.read(), repr(self.set)) finally: fo.close() - test_support.unlink(test_support.TESTFN) + support.unlink(support.TESTFN) def test_length(self): self.assertEqual(len(self.set), self.length) @@ -1670,14 +1670,14 @@ TestGraphs, ) - test_support.run_unittest(*test_classes) + support.run_unittest(*test_classes) # verify reference counting if verbose and hasattr(sys, "gettotalrefcount"): import gc counts = [None] * 5 for i in xrange(len(counts)): - test_support.run_unittest(*test_classes) + support.run_unittest(*test_classes) gc.collect() counts[i] = sys.gettotalrefcount() print counts Index: Lib/test/test_descr.py =================================================================== --- Lib/test/test_descr.py (revision 62290) +++ Lib/test/test_descr.py (working copy) @@ -3,7 +3,7 @@ import warnings from copy import deepcopy -from test import test_support +from test import support class OperatorsTest(unittest.TestCase): @@ -1798,7 +1798,7 @@ # sys.stdout needs to be the original to trigger the recursion bug import sys test_stdout = sys.stdout - sys.stdout = test_support.get_original_stdout() + sys.stdout = support.get_original_stdout() try: # nothing should actually be printed, this should raise an exception print Letter('w') @@ -2639,12 +2639,12 @@ self.ateof = 1 return s - f = file(name=test_support.TESTFN, mode='w') + f = file(name=support.TESTFN, mode='w') lines = ['a\n', 'b\n', 'c\n'] try: f.writelines(lines) f.close() - f = CountedInput(test_support.TESTFN) + f = CountedInput(support.TESTFN) for (i, expected) in zip(range(1, 5) + [4], lines + 2 * [""]): got = f.readline() self.assertEqual(expected, got) @@ -2656,7 +2656,7 @@ f.close() except: pass - test_support.unlink(test_support.TESTFN) + support.unlink(support.TESTFN) def test_keywords(self): # Testing keyword args to basic type constructors ... @@ -4343,7 +4343,7 @@ def test_main(): # Run all local test cases, with PTypesLongInitTest first. - test_support.run_unittest(PTypesLongInitTest, OperatorsTest, + support.run_unittest(PTypesLongInitTest, OperatorsTest, ClassPropertiesAndMethods, DictProxyTests) if __name__ == "__main__": Index: Lib/test/test_crypt.py =================================================================== --- Lib/test/test_crypt.py (revision 62290) +++ Lib/test/test_crypt.py (working copy) @@ -1,4 +1,4 @@ -from test import test_support +from test import support import unittest import crypt @@ -6,11 +6,11 @@ def test_crypt(self): c = crypt.crypt('mypassword', 'ab') - if test_support.verbose: + if support.verbose: print 'Test encryption: ', c def test_main(): - test_support.run_unittest(CryptTestCase) + support.run_unittest(CryptTestCase) if __name__ == "__main__": test_main() Index: Lib/test/test_ssl.py =================================================================== --- Lib/test/test_ssl.py (revision 62290) +++ Lib/test/test_ssl.py (working copy) @@ -2,7 +2,7 @@ import sys import unittest -from test import test_support +from test import support import socket import errno import subprocess @@ -23,27 +23,27 @@ except ImportError: skip_expected = True -HOST = test_support.HOST +HOST = support.HOST CERTFILE = None SVN_PYTHON_ORG_ROOT_CERT = None def handle_error(prefix): exc_format = ' '.join(traceback.format_exception(*sys.exc_info())) - if test_support.verbose: + if support.verbose: sys.stdout.write(prefix + exc_format) class BasicTests(unittest.TestCase): def testSSLconnect(self): - if not test_support.is_resource_enabled('network'): + if not support.is_resource_enabled('network'): return s = ssl.wrap_socket(socket.socket(socket.AF_INET), cert_reqs=ssl.CERT_NONE) s.connect(("svn.python.org", 443)) c = s.getpeercert() if c: - raise test_support.TestFailed("Peer cert %s shouldn't be here!") + raise support.TestFailed("Peer cert %s shouldn't be here!") s.close() # this should fail because we have no verification certs @@ -68,7 +68,7 @@ def testRAND(self): v = ssl.RAND_status() - if test_support.verbose: + if support.verbose: sys.stdout.write("\n RAND_status is %d (%s)\n" % (v, (v and "sufficient randomness") or "insufficient randomness")) @@ -85,7 +85,7 @@ # provided solely for this test, to exercise the certificate # parsing code p = ssl._ssl._test_decode_cert(CERTFILE, False) - if test_support.verbose: + if support.verbose: sys.stdout.write("\n" + pprint.pformat(p) + "\n") def testDERtoPEM(self): @@ -95,7 +95,7 @@ p2 = ssl.DER_cert_to_PEM_cert(d1) d2 = ssl.PEM_cert_to_DER_cert(p2) if (d1 != d2): - raise test_support.TestFailed("PEM-to-DER or DER-to-PEM translation failed") + raise support.TestFailed("PEM-to-DER or DER-to-PEM translation failed") class NetworkTests(unittest.TestCase): @@ -106,7 +106,7 @@ s.connect(("svn.python.org", 443)) c = s.getpeercert() if c: - raise test_support.TestFailed("Peer cert %s shouldn't be here!") + raise support.TestFailed("Peer cert %s shouldn't be here!") s.close() # this should fail because we have no verification certs @@ -126,7 +126,7 @@ try: s.connect(("svn.python.org", 443)) except ssl.SSLError, x: - raise test_support.TestFailed("Unexpected exception %s" % x) + raise support.TestFailed("Unexpected exception %s" % x) finally: s.close() @@ -134,7 +134,7 @@ pem = ssl.get_server_certificate(("svn.python.org", 443)) if not pem: - raise test_support.TestFailed("No server certificate on svn.python.org:443!") + raise support.TestFailed("No server certificate on svn.python.org:443!") try: pem = ssl.get_server_certificate(("svn.python.org", 443), ca_certs=CERTFILE) @@ -142,12 +142,12 @@ #should fail pass else: - raise test_support.TestFailed("Got server certificate %s for svn.python.org!" % pem) + raise support.TestFailed("Got server certificate %s for svn.python.org!" % pem) pem = ssl.get_server_certificate(("svn.python.org", 443), ca_certs=SVN_PYTHON_ORG_ROOT_CERT) if not pem: - raise test_support.TestFailed("No server certificate on svn.python.org:443!") - if test_support.verbose: + raise support.TestFailed("No server certificate on svn.python.org:443!") + if support.verbose: sys.stdout.write("\nVerified certificate for svn.python.org:443 is\n%s\n" % pem) @@ -199,13 +199,13 @@ else: if self.server.certreqs == ssl.CERT_REQUIRED: cert = self.sslconn.getpeercert() - if test_support.verbose and self.server.chatty: + if support.verbose and self.server.chatty: sys.stdout.write(" client cert is " + pprint.pformat(cert) + "\n") cert_binary = self.sslconn.getpeercert(True) - if test_support.verbose and self.server.chatty: + if support.verbose and self.server.chatty: sys.stdout.write(" cert binary is " + str(len(cert_binary)) + " bytes\n") cipher = self.sslconn.cipher() - if test_support.verbose and self.server.chatty: + if support.verbose and self.server.chatty: sys.stdout.write(" server: connection cipher is now " + str(cipher) + "\n") return True @@ -240,18 +240,18 @@ self.running = False self.close() elif msg.strip() == 'over': - if test_support.verbose and self.server.connectionchatty: + if support.verbose and self.server.connectionchatty: sys.stdout.write(" server: client closed connection\n") self.close() return elif self.server.starttls_server and msg.strip() == 'STARTTLS': - if test_support.verbose and self.server.connectionchatty: + if support.verbose and self.server.connectionchatty: sys.stdout.write(" server: read STARTTLS from client, sending OK...\n") self.write("OK\n") if not self.wrap_conn(): return else: - if (test_support.verbose and + if (support.verbose and self.server.connectionchatty): ctype = (self.sslconn and "encrypted") or "unencrypted" sys.stdout.write(" server: read %s (%s), sending back %s (%s)...\n" @@ -284,7 +284,7 @@ self.connectionchatty = connectionchatty self.starttls_server = starttls_server self.sock = socket.socket() - self.port = test_support.bind_port(self.sock) + self.port = support.bind_port(self.sock) self.flag = None self.active = False threading.Thread.__init__(self) @@ -304,7 +304,7 @@ while self.active: try: newconn, connaddr = self.sock.accept() - if test_support.verbose and self.chatty: + if support.verbose and self.chatty: sys.stdout.write(' server: new connection from ' + str(connaddr) + '\n') handler = self.ConnectionHandler(self, newconn) @@ -420,7 +420,7 @@ # we override this to suppress logging unless "verbose" - if test_support.verbose: + if support.verbose: sys.stdout.write(" server (%s, %d, %s):\n [%s] %s\n" % (self.server.server_name, self.server.server_port, @@ -433,7 +433,7 @@ self.flag = None self.active = False self.RootedHTTPRequestHandler.root = os.path.split(CERTFILE)[0] - self.port = test_support.find_unused_port() + self.port = support.find_unused_port() self.server = self.HTTPSServer( (HOST, self.port), self.RootedHTTPRequestHandler, certfile) threading.Thread.__init__(self) @@ -476,10 +476,10 @@ ssl_version=ssl.PROTOCOL_TLSv1) s.connect((HOST, server.port)) except ssl.SSLError, x: - if test_support.verbose: + if support.verbose: sys.stdout.write("\nSSLError is %s\n" % x[1]) else: - raise test_support.TestFailed( + raise support.TestFailed( "Use of invalid cert should have failed!") finally: server.stop() @@ -511,27 +511,27 @@ ssl_version=client_protocol) s.connect((HOST, server.port)) except ssl.SSLError, x: - raise test_support.TestFailed("Unexpected SSL error: " + str(x)) + raise support.TestFailed("Unexpected SSL error: " + str(x)) except Exception, x: - raise test_support.TestFailed("Unexpected exception: " + str(x)) + raise support.TestFailed("Unexpected exception: " + str(x)) else: if connectionchatty: - if test_support.verbose: + if support.verbose: sys.stdout.write( " client: sending %s...\n" % (repr(indata))) s.write(indata) outdata = s.read() if connectionchatty: - if test_support.verbose: + if support.verbose: sys.stdout.write(" client: read %s\n" % repr(outdata)) if outdata != indata.lower(): - raise test_support.TestFailed( + raise support.TestFailed( "bad data <<%s>> (%d) received; expected <<%s>> (%d)\n" % (outdata[:min(len(outdata),20)], len(outdata), indata[:min(len(indata),20)].lower(), len(indata))) s.write("over\n") if connectionchatty: - if test_support.verbose: + if support.verbose: sys.stdout.write(" client: closing connection.\n") s.close() finally: @@ -552,7 +552,7 @@ certtype = "CERT_OPTIONAL" elif certsreqs == ssl.CERT_REQUIRED: certtype = "CERT_REQUIRED" - if test_support.verbose: + if support.verbose: formatstr = (expectedToWork and " %s->%s %s\n") or " {%s->%s} %s\n" sys.stdout.write(formatstr % (ssl.get_protocol_name(client_protocol), @@ -561,12 +561,12 @@ try: serverParamsTest(CERTFILE, server_protocol, certsreqs, CERTFILE, CERTFILE, client_protocol, chatty=False) - except test_support.TestFailed: + except support.TestFailed: if expectedToWork: raise else: if not expectedToWork: - raise test_support.TestFailed( + raise support.TestFailed( "Client protocol %s succeeded with server protocol %s!" % (ssl.get_protocol_name(client_protocol), ssl.get_protocol_name(server_protocol))) @@ -578,7 +578,7 @@ listener_ready = threading.Event() listener_gone = threading.Event() - port = test_support.find_unused_port() + port = support.find_unused_port() # `listener` runs in a thread. It opens a socket listening on # PORT, and sits in an accept() until the main thread connects. @@ -603,7 +603,7 @@ except socket.sslerror: pass else: - raise test_support.TestFailed( + raise support.TestFailed( 'connecting to closed SSL socket should have failed') t = threading.Thread(target=listener) @@ -613,7 +613,7 @@ def testEcho (self): - if test_support.verbose: + if support.verbose: sys.stdout.write("\n") serverParamsTest(CERTFILE, ssl.PROTOCOL_TLSv1, ssl.CERT_NONE, CERTFILE, CERTFILE, ssl.PROTOCOL_TLSv1, @@ -621,7 +621,7 @@ def testReadCert(self): - if test_support.verbose: + if support.verbose: sys.stdout.write("\n") s2 = socket.socket() server = ThreadedEchoServer(CERTFILE, @@ -643,30 +643,30 @@ ssl_version=ssl.PROTOCOL_SSLv23) s.connect((HOST, server.port)) except ssl.SSLError, x: - raise test_support.TestFailed( + raise support.TestFailed( "Unexpected SSL error: " + str(x)) except Exception, x: - raise test_support.TestFailed( + raise support.TestFailed( "Unexpected exception: " + str(x)) else: if not s: - raise test_support.TestFailed( + raise support.TestFailed( "Can't SSL-handshake with test server") cert = s.getpeercert() if not cert: - raise test_support.TestFailed( + raise support.TestFailed( "Can't get peer certificate.") cipher = s.cipher() - if test_support.verbose: + if support.verbose: sys.stdout.write(pprint.pformat(cert) + '\n') sys.stdout.write("Connection cipher is " + str(cipher) + '.\n') if not cert.has_key('subject'): - raise test_support.TestFailed( + raise support.TestFailed( "No subject field in certificate: %s." % pprint.pformat(cert)) if ((('organizationName', 'Python Software Foundation'),) not in cert['subject']): - raise test_support.TestFailed( + raise support.TestFailed( "Missing or invalid 'organizationName' field in certificate subject; " "should be 'Python Software Foundation'.") s.close() @@ -685,7 +685,7 @@ "badkey.pem")) def testProtocolSSL2(self): - if test_support.verbose: + if support.verbose: sys.stdout.write("\n") tryProtocolCombo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv2, True) tryProtocolCombo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv2, True, ssl.CERT_OPTIONAL) @@ -695,13 +695,13 @@ tryProtocolCombo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_TLSv1, False) def testProtocolSSL23(self): - if test_support.verbose: + if support.verbose: sys.stdout.write("\n") try: tryProtocolCombo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_SSLv2, True) - except test_support.TestFailed, x: + except support.TestFailed, x: # this fails on some older versions of OpenSSL (0.9.7l, for instance) - if test_support.verbose: + if support.verbose: sys.stdout.write( " SSL2 client to SSL23 server test unexpectedly failed:\n %s\n" % str(x)) @@ -718,7 +718,7 @@ tryProtocolCombo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_TLSv1, True, ssl.CERT_REQUIRED) def testProtocolSSL3(self): - if test_support.verbose: + if support.verbose: sys.stdout.write("\n") tryProtocolCombo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_SSLv3, True) tryProtocolCombo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_SSLv3, True, ssl.CERT_OPTIONAL) @@ -728,7 +728,7 @@ tryProtocolCombo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_TLSv1, False) def testProtocolTLS1(self): - if test_support.verbose: + if support.verbose: sys.stdout.write("\n") tryProtocolCombo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_TLSv1, True) tryProtocolCombo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_TLSv1, True, ssl.CERT_OPTIONAL) @@ -758,12 +758,12 @@ s.setblocking(1) s.connect((HOST, server.port)) except Exception, x: - raise test_support.TestFailed("Unexpected exception: " + str(x)) + raise support.TestFailed("Unexpected exception: " + str(x)) else: - if test_support.verbose: + if support.verbose: sys.stdout.write("\n") for indata in msgs: - if test_support.verbose: + if support.verbose: sys.stdout.write( " client: sending %s...\n" % repr(indata)) if wrapped: @@ -774,7 +774,7 @@ outdata = s.recv(1024) if (indata == "STARTTLS" and outdata.strip().lower().startswith("ok")): - if test_support.verbose: + if support.verbose: sys.stdout.write( " client: read %s from server, starting TLS...\n" % repr(outdata)) @@ -782,10 +782,10 @@ wrapped = True else: - if test_support.verbose: + if support.verbose: sys.stdout.write( " client: read %s from server\n" % repr(outdata)) - if test_support.verbose: + if support.verbose: sys.stdout.write(" client: closing connection.\n") if wrapped: conn.write("over\n") @@ -805,7 +805,7 @@ flag.wait() # try to connect try: - if test_support.verbose: + if support.verbose: sys.stdout.write('\n') d1 = open(CERTFILE, 'rb').read() d2 = '' @@ -816,19 +816,19 @@ dlen = f.info().getheader("content-length") if dlen and (int(dlen) > 0): d2 = f.read(int(dlen)) - if test_support.verbose: + if support.verbose: sys.stdout.write( " client: read %d bytes from remote server '%s'\n" % (len(d2), server)) f.close() except: msg = ''.join(traceback.format_exception(*sys.exc_info())) - if test_support.verbose: + if support.verbose: sys.stdout.write('\n' + msg) - raise test_support.TestFailed(msg) + raise support.TestFailed(msg) else: if not (d1 == d2): - raise test_support.TestFailed( + raise support.TestFailed( "Couldn't fetch data from HTTPS server") finally: server.stop() @@ -837,7 +837,7 @@ def test_main(verbose=False): if skip_expected: - raise test_support.TestSkipped("No SSL support") + raise support.TestSkipped("No SSL support") global CERTFILE, SVN_PYTHON_ORG_ROOT_CERT CERTFILE = os.path.join(os.path.dirname(__file__) or os.curdir, @@ -848,22 +848,22 @@ if (not os.path.exists(CERTFILE) or not os.path.exists(SVN_PYTHON_ORG_ROOT_CERT)): - raise test_support.TestFailed("Can't read certificate files!") + raise support.TestFailed("Can't read certificate files!") tests = [BasicTests] - if test_support.is_resource_enabled('network'): + if support.is_resource_enabled('network'): tests.append(NetworkTests) if _have_threads: - thread_info = test_support.threading_setup() - if thread_info and test_support.is_resource_enabled('network'): + thread_info = support.threading_setup() + if thread_info and support.is_resource_enabled('network'): tests.append(ConnectedTests) - test_support.run_unittest(*tests) + support.run_unittest(*tests) if _have_threads: - test_support.threading_cleanup(*thread_info) + support.threading_cleanup(*thread_info) if __name__ == "__main__": test_main() Index: Lib/test/test_frozen.py =================================================================== --- Lib/test/test_frozen.py (revision 62290) +++ Lib/test/test_frozen.py (working copy) @@ -1,7 +1,7 @@ # Test the frozen module defined in frozen.c. from __future__ import with_statement -from test.test_support import captured_stdout, run_unittest +from test.support import captured_stdout, run_unittest import unittest import sys, os Index: Lib/test/test_bufio.py =================================================================== --- Lib/test/test_bufio.py (revision 62290) +++ Lib/test/test_bufio.py (working copy) @@ -1,5 +1,5 @@ import unittest -from test import test_support +from test import support # Simple test to ensure that optimizations in fileobject.c deliver # the expected results. For best testing, run this under a debug-build @@ -14,18 +14,18 @@ # .readline()s deliver what we wrote. # Ensure we can open TESTFN for writing. - test_support.unlink(test_support.TESTFN) + support.unlink(support.TESTFN) # Since C doesn't guarantee we can write/read arbitrary bytes in text # files, use binary mode. - f = open(test_support.TESTFN, "wb") + f = open(support.TESTFN, "wb") try: # write once with \n and once without f.write(s) f.write("\n") f.write(s) f.close() - f = open(test_support.TESTFN, "rb") + f = open(support.TESTFN, "rb") line = f.readline() self.assertEqual(line, s + "\n") line = f.readline() @@ -34,7 +34,7 @@ self.assert_(not line) # Must be at EOF f.close() finally: - test_support.unlink(test_support.TESTFN) + support.unlink(support.TESTFN) def drive_one(self, pattern): for length in lengths: @@ -59,7 +59,7 @@ self.drive_one("\0" * 1000) def test_main(): - test_support.run_unittest(BufferSizeTest) + support.run_unittest(BufferSizeTest) if __name__ == "__main__": test_main() Index: Lib/test/test_threadedtempfile.py =================================================================== --- Lib/test/test_threadedtempfile.py (revision 62290) +++ Lib/test/test_threadedtempfile.py (working copy) @@ -20,7 +20,7 @@ import threading import tempfile -from test.test_support import threading_setup, threading_cleanup, run_unittest +from test.support import threading_setup, threading_cleanup, run_unittest import unittest import StringIO from traceback import print_exc Index: Lib/test/test_winsound.py =================================================================== --- Lib/test/test_winsound.py (revision 62290) +++ Lib/test/test_winsound.py (working copy) @@ -1,7 +1,7 @@ # Ridiculously simple test of the winsound module for Windows. import unittest -from test import test_support +from test import support import winsound, time import os import subprocess @@ -225,7 +225,7 @@ def test_main(): - test_support.run_unittest(BeepTest, MessageBeepTest, PlaySoundTest) + support.run_unittest(BeepTest, MessageBeepTest, PlaySoundTest) if __name__=="__main__": test_main() Index: Lib/test/test_complex.py =================================================================== --- Lib/test/test_complex.py (revision 62290) +++ Lib/test/test_complex.py (working copy) @@ -1,5 +1,5 @@ import unittest, os -from test import test_support +from test import support import warnings warnings.filterwarnings( @@ -248,7 +248,7 @@ self.assertRaises(TypeError, complex, 1, "1") self.assertEqual(complex(" 3.14+J "), 3.14+1j) - if test_support.have_unicode: + if support.have_unicode: self.assertEqual(complex(unicode(" 3.14+J ")), 3.14+1j) # SF bug 543840: complex(string) accepts strings with \0 @@ -272,7 +272,7 @@ self.assertRaises(ValueError, complex, "1+2j)") self.assertRaises(ValueError, complex, "1+(2j)") self.assertRaises(ValueError, complex, "(1+2j)123") - if test_support.have_unicode: + if support.have_unicode: self.assertRaises(ValueError, complex, unicode("1"*500)) self.assertRaises(ValueError, complex, unicode("x")) @@ -360,16 +360,16 @@ fo = None try: - fo = open(test_support.TESTFN, "wb") + fo = open(support.TESTFN, "wb") print >>fo, a, b fo.close() - fo = open(test_support.TESTFN, "rb") + fo = open(support.TESTFN, "rb") self.assertEqual(fo.read(), "%s %s\n" % (a, b)) finally: if (fo is not None) and (not fo.closed): fo.close() try: - os.remove(test_support.TESTFN) + os.remove(support.TESTFN) except (OSError, IOError): pass @@ -381,7 +381,7 @@ self.assertEquals(atan2(z2.imag, -1.), atan2(-0., -1.)) def test_main(): - test_support.run_unittest(ComplexTest) + support.run_unittest(ComplexTest) if __name__ == "__main__": test_main() Index: Lib/test/test_hmac.py =================================================================== --- Lib/test/test_hmac.py (revision 62290) +++ Lib/test/test_hmac.py (working copy) @@ -2,7 +2,7 @@ import hashlib import unittest import warnings -from test import test_support +from test import support class TestVectorsTestCase(unittest.TestCase): @@ -211,7 +211,7 @@ def digest(self): return self._x.digest() - with test_support.catch_warning(): + with support.catch_warning(): warnings.simplefilter('error', RuntimeWarning) try: hmac.HMAC('a', 'b', digestmod=MockCrazyHash) @@ -309,7 +309,7 @@ "Hexdigest of copy doesn't match original hexdigest.") def test_main(): - test_support.run_unittest( + support.run_unittest( TestVectorsTestCase, ConstructorTestCase, SanityTestCase, Index: Lib/test/test_generators.py =================================================================== --- Lib/test/test_generators.py (revision 62290) +++ Lib/test/test_generators.py (working copy) @@ -1862,8 +1862,8 @@ # Note that doctest and regrtest both look in sys.argv for a "-v" argument, # so this works as expected in both ways of running regrtest. def test_main(verbose=None): - from test import test_support, test_generators - test_support.run_doctest(test_generators, verbose) + from test import support, test_generators + support.run_doctest(test_generators, verbose) # This part isn't needed for regrtest, but for running the test directly. if __name__ == "__main__": Index: Lib/test/test_list.py =================================================================== --- Lib/test/test_list.py (revision 62290) +++ Lib/test/test_list.py (working copy) @@ -1,5 +1,5 @@ import sys -from test import test_support, list_tests +from test import support, list_tests class ListTest(list_tests.CommonTest): type2test = list @@ -27,7 +27,7 @@ self.assertRaises((MemoryError, OverflowError), imul, lst, n) def test_main(verbose=None): - test_support.run_unittest(ListTest) + support.run_unittest(ListTest) # verify reference counting import sys @@ -35,7 +35,7 @@ import gc counts = [None] * 5 for i in xrange(len(counts)): - test_support.run_unittest(ListTest) + support.run_unittest(ListTest) gc.collect() counts[i] = sys.gettotalrefcount() print counts Index: Lib/test/test_pep263.py =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: Lib/test/test_quopri.py =================================================================== --- Lib/test/test_quopri.py (revision 62290) +++ Lib/test/test_quopri.py (working copy) @@ -1,4 +1,4 @@ -from test import test_support +from test import support import unittest import sys, cStringIO, subprocess @@ -192,7 +192,7 @@ self.assertEqual(cout.splitlines(), p.splitlines()) def test_main(): - test_support.run_unittest(QuopriTestCase) + support.run_unittest(QuopriTestCase) if __name__ == "__main__": Index: Lib/test/test_fork1.py =================================================================== --- Lib/test/test_fork1.py (revision 62290) +++ Lib/test/test_fork1.py (working copy) @@ -4,7 +4,7 @@ import os import time from test.fork_wait import ForkWait -from test.test_support import TestSkipped, run_unittest, reap_children +from test.support import TestSkipped, run_unittest, reap_children try: os.fork Index: Lib/test/test_pep277.py =================================================================== --- Lib/test/test_pep277.py (revision 62290) +++ Lib/test/test_pep277.py (working copy) @@ -1,9 +1,9 @@ # Test the Unicode versions of normal file functions # open, os.open, os.stat. os.listdir, os.rename, os.remove, os.mkdir, os.chdir, os.rmdir import sys, os, unittest -from test import test_support +from test import support if not os.path.supports_unicode_filenames: - raise test_support.TestSkipped, "test works only on NT+" + raise support.TestSkipped, "test works only on NT+" filenames = [ 'abc', @@ -28,11 +28,11 @@ os.rmdir(dirname) class UnicodeFileTests(unittest.TestCase): - files = [os.path.join(test_support.TESTFN, f) for f in filenames] + files = [os.path.join(support.TESTFN, f) for f in filenames] def setUp(self): try: - os.mkdir(test_support.TESTFN) + os.mkdir(support.TESTFN) except OSError: pass for name in self.files: @@ -42,17 +42,17 @@ os.stat(name) def tearDown(self): - deltree(test_support.TESTFN) + deltree(support.TESTFN) def _apply_failure(self, fn, filename, expected_exception, check_fn_in_exception = True): try: fn(filename) - raise test_support.TestFailed("Expected to fail calling '%s(%r)'" + raise support.TestFailed("Expected to fail calling '%s(%r)'" % (fn.__name__, filename)) except expected_exception, details: if check_fn_in_exception and details.filename != filename: - raise test_support.TestFailed("Function '%s(%r) failed with " + raise support.TestFailed("Function '%s(%r) failed with " "bad filename in the exception: %r" % (fn.__name__, filename, details.filename)) @@ -77,10 +77,10 @@ os.stat(name) def test_listdir(self): - f1 = os.listdir(test_support.TESTFN) - f2 = os.listdir(unicode(test_support.TESTFN, + f1 = os.listdir(support.TESTFN) + f2 = os.listdir(unicode(support.TESTFN, sys.getfilesystemencoding())) - sf2 = set(u"\\".join((unicode(test_support.TESTFN), f)) + sf2 = set(u"\\".join((unicode(support.TESTFN), f)) for f in f2) self.failUnlessEqual(len(f1), len(self.files)) self.failUnlessEqual(sf2, set(self.files)) @@ -91,7 +91,7 @@ os.rename("tmp",name) def test_directory(self): - dirname = os.path.join(test_support.TESTFN,u'Gr\xfc\xdf-\u66e8\u66e9\u66eb') + dirname = os.path.join(support.TESTFN,u'Gr\xfc\xdf-\u66e8\u66e9\u66eb') filename = u'\xdf-\u66e8\u66e9\u66eb' oldwd = os.getcwd() os.mkdir(dirname) @@ -106,9 +106,9 @@ def test_main(): try: - test_support.run_unittest(UnicodeFileTests) + support.run_unittest(UnicodeFileTests) finally: - deltree(test_support.TESTFN) + deltree(support.TESTFN) if __name__ == "__main__": test_main() Index: Lib/test/test_doctest2.py =================================================================== --- Lib/test/test_doctest2.py (revision 62290) +++ Lib/test/test_doctest2.py (working copy) @@ -12,7 +12,7 @@ """ -from test import test_support +from test import support class C(object): u"""Class C. @@ -107,9 +107,9 @@ def test_main(): from test import test_doctest2 EXPECTED = 19 - f, t = test_support.run_doctest(test_doctest2) + f, t = support.run_doctest(test_doctest2) if t != EXPECTED: - raise test_support.TestFailed("expected %d tests to run, not %d" % + raise support.TestFailed("expected %d tests to run, not %d" % (EXPECTED, t)) # Pollute the namespace with a bunch of imported functions and classes, Index: Lib/test/test_softspace.py =================================================================== --- Lib/test/test_softspace.py (revision 62290) +++ Lib/test/test_softspace.py (working copy) @@ -1,4 +1,4 @@ -from test.test_support import run_unittest +from test.support import run_unittest import unittest import StringIO Index: Lib/test/test_wait3.py =================================================================== --- Lib/test/test_wait3.py (revision 62290) +++ Lib/test/test_wait3.py (working copy) @@ -4,7 +4,7 @@ import os import time from test.fork_wait import ForkWait -from test.test_support import TestSkipped, run_unittest, reap_children +from test.support import TestSkipped, run_unittest, reap_children try: os.fork Index: Lib/test/test_xmllib.py =================================================================== --- Lib/test/test_xmllib.py (revision 62290) +++ Lib/test/test_xmllib.py (working copy) @@ -19,7 +19,7 @@ warnings.filterwarnings("ignore", ".* xmllib .* obsolete.*", DeprecationWarning, r'xmllib$') -from test import test_support +from test import support import unittest import xmllib @@ -45,7 +45,7 @@ def test_main(): - test_support.run_unittest(XMLParserTestCase) + support.run_unittest(XMLParserTestCase) if __name__ == "__main__": test_main() Index: Lib/test/test_opcodes.py =================================================================== --- Lib/test/test_opcodes.py (revision 62290) +++ Lib/test/test_opcodes.py (working copy) @@ -1,6 +1,6 @@ # Python test set -- part 2, opcodes -from test.test_support import run_unittest +from test.support import run_unittest import unittest class OpcodeTest(unittest.TestCase): Index: Lib/test/test_strftime.py =================================================================== --- Lib/test/test_strftime.py (revision 62290) +++ Lib/test/test_strftime.py (working copy) @@ -6,7 +6,7 @@ import sys import os import re -from test import test_support +from test import support import time import unittest @@ -70,7 +70,7 @@ self.strftest1(now) self.strftest2(now) - if test_support.verbose: + if support.verbose: print "Strftime test, platform: %s, Python version: %s" % \ (sys.platform, sys.version.split()[0]) @@ -82,7 +82,7 @@ self.strftest2(arg) def strftest1(self, now): - if test_support.verbose: + if support.verbose: print "strftime test for", time.ctime(now) now = self.now # Make sure any characters that could be taken as regex syntax is @@ -163,25 +163,25 @@ except ValueError, result: msg = "Error for nonstandard '%s' format (%s): %s" % \ (e[0], e[2], str(result)) - if test_support.verbose: + if support.verbose: print msg continue if re.match(escapestr(e[1], self.ampm), result): - if test_support.verbose: + if support.verbose: print "Supports nonstandard '%s' format (%s)" % (e[0], e[2]) elif not result or result[0] == '%': - if test_support.verbose: + if support.verbose: print "Does not appear to support '%s' format (%s)" % \ (e[0], e[2]) else: - if test_support.verbose: + if support.verbose: print "Conflict for nonstandard '%s' format (%s):" % \ (e[0], e[2]) print " Expected %s, but got %s" % (e[1], result) def test_main(): - test_support.run_unittest(StrftimeTest) + support.run_unittest(StrftimeTest) if __name__ == '__main__': test_main() Index: Lib/test/test_ntpath.py =================================================================== --- Lib/test/test_ntpath.py (revision 62290) +++ Lib/test/test_ntpath.py (working copy) @@ -1,7 +1,7 @@ import ntpath import os -from test.test_support import verbose, TestFailed -import test.test_support as test_support +from test.support import verbose, TestFailed +import test.support as support import unittest @@ -180,7 +180,7 @@ def test_main(): - test_support.run_unittest(TestNtpath) + support.run_unittest(TestNtpath) if __name__ == "__main__": Index: Lib/test/test_kqueue.py =================================================================== --- Lib/test/test_kqueue.py (revision 62290) +++ Lib/test/test_kqueue.py (working copy) @@ -8,9 +8,9 @@ import sys import unittest -from test import test_support +from test import support if not hasattr(select, "kqueue"): - raise test_support.TestSkipped("test works only on BSD") + raise support.TestSkipped("test works only on BSD") class TestKQueue(unittest.TestCase): def test_create_queue(self): @@ -160,7 +160,7 @@ serverSocket.close() def test_main(): - test_support.run_unittest(TestKQueue) + support.run_unittest(TestKQueue) if __name__ == "__main__": test_main() Index: Lib/test/test_isinstance.py =================================================================== --- Lib/test/test_isinstance.py (revision 62290) +++ Lib/test/test_isinstance.py (working copy) @@ -3,7 +3,7 @@ # testing of error conditions uncovered when using extension types. import unittest -from test import test_support +from test import support import sys @@ -243,7 +243,7 @@ self.assertEqual(True, issubclass(NewSuper, (NewChild, (NewSuper,)))) self.assertEqual(True, issubclass(int, (long, (float, int)))) - if test_support.have_unicode: + if support.have_unicode: self.assertEqual(True, issubclass(str, (unicode, (Child, NewChild, basestring)))) def test_subclass_recursion_limit(self): @@ -266,7 +266,7 @@ def test_main(): - test_support.run_unittest( + support.run_unittest( TestIsInstanceExceptions, TestIsSubclassExceptions, TestIsInstanceIsSubclass Index: Lib/test/test_site.py =================================================================== --- Lib/test/test_site.py (revision 62290) +++ Lib/test/test_site.py (working copy) @@ -5,7 +5,7 @@ """ import unittest -from test.test_support import TestSkipped, run_unittest, TESTFN +from test.support import TestSkipped, run_unittest, TESTFN import __builtin__ import os import sys Index: Lib/test/test_inspect.py =================================================================== --- Lib/test/test_inspect.py (revision 62290) +++ Lib/test/test_inspect.py (working copy) @@ -4,7 +4,7 @@ import inspect import datetime -from test.test_support import TESTFN, run_unittest +from test.support import TESTFN, run_unittest from test import inspect_fodder as mod from test import inspect_fodder2 as mod2 Index: Lib/test/test_ioctl.py =================================================================== --- Lib/test/test_ioctl.py (revision 62290) +++ Lib/test/test_ioctl.py (working copy) @@ -1,5 +1,5 @@ import unittest -from test.test_support import TestSkipped, run_unittest +from test.support import TestSkipped, run_unittest import os, struct try: import fcntl, termios Index: Lib/test/test_bsddb185.py =================================================================== --- Lib/test/test_bsddb185.py (revision 62290) +++ Lib/test/test_bsddb185.py (working copy) @@ -4,7 +4,7 @@ testing suite. """ -from test.test_support import run_unittest, findfile +from test.support import run_unittest, findfile import unittest import bsddb185 import anydbm Index: Lib/test/test_contains.py =================================================================== --- Lib/test/test_contains.py (revision 62290) +++ Lib/test/test_contains.py (working copy) @@ -1,4 +1,4 @@ -from test.test_support import have_unicode, run_unittest +from test.support import have_unicode, run_unittest import unittest Index: Lib/test/test_array.py =================================================================== --- Lib/test/test_array.py (revision 62290) +++ Lib/test/test_array.py (working copy) @@ -4,7 +4,7 @@ """ import unittest -from test import test_support +from test import support from weakref import proxy import array, cStringIO from cPickle import loads, dumps @@ -163,13 +163,13 @@ a = array.array(self.typecode, 2*self.example) self.assertRaises(TypeError, a.tofile) self.assertRaises(TypeError, a.tofile, cStringIO.StringIO()) - test_support.unlink(test_support.TESTFN) - f = open(test_support.TESTFN, 'wb') + support.unlink(support.TESTFN) + f = open(support.TESTFN, 'wb') try: a.tofile(f) f.close() b = array.array(self.typecode) - f = open(test_support.TESTFN, 'rb') + f = open(support.TESTFN, 'rb') self.assertRaises(TypeError, b.fromfile) self.assertRaises( TypeError, @@ -186,7 +186,7 @@ finally: if not f.closed: f.close() - test_support.unlink(test_support.TESTFN) + support.unlink(support.TESTFN) def test_tofromlist(self): a = array.array(self.typecode, 2*self.example) @@ -787,7 +787,7 @@ tests.append(CharacterTest) -if test_support.have_unicode: +if support.have_unicode: class UnicodeTest(StringTest): typecode = 'u' example = unicode(r'\x01\u263a\x00\ufeff', 'unicode-escape') @@ -1014,14 +1014,14 @@ def test_main(verbose=None): import sys - test_support.run_unittest(*tests) + support.run_unittest(*tests) # verify reference counting if verbose and hasattr(sys, "gettotalrefcount"): import gc counts = [None] * 5 for i in xrange(len(counts)): - test_support.run_unittest(*tests) + support.run_unittest(*tests) gc.collect() counts[i] = sys.gettotalrefcount() print counts Index: Lib/test/test_dis.py =================================================================== --- Lib/test/test_dis.py (revision 62290) +++ Lib/test/test_dis.py (working copy) @@ -1,6 +1,6 @@ # Minimal tests for dis module -from test.test_support import run_unittest +from test.support import run_unittest import unittest import sys import dis Index: Lib/test/test_dummy_threading.py =================================================================== --- Lib/test/test_dummy_threading.py (revision 62290) +++ Lib/test/test_dummy_threading.py (working copy) @@ -1,4 +1,4 @@ -from test import test_support +from test import support import unittest import dummy_threading as _threading import time @@ -15,20 +15,20 @@ # module. #delay = random.random() * 2 delay = 0 - if test_support.verbose: + if support.verbose: print 'task', self.getName(), 'will run for', delay, 'sec' sema.acquire() mutex.acquire() running += 1 - if test_support.verbose: + if support.verbose: print running, 'tasks are running' mutex.release() time.sleep(delay) - if test_support.verbose: + if support.verbose: print 'task', self.getName(), 'done' mutex.acquire() running -= 1 - if test_support.verbose: + if support.verbose: print self.getName(), 'is finished.', running, 'tasks are running' mutex.release() sema.release() @@ -49,15 +49,15 @@ self.threads.append(t) t.start() - if test_support.verbose: + if support.verbose: print 'waiting for all tasks to complete' for t in self.threads: t.join() - if test_support.verbose: + if support.verbose: print 'all tasks done' def test_main(): - test_support.run_unittest(DummyThreadingTestCase) + support.run_unittest(DummyThreadingTestCase) if __name__ == '__main__': test_main() Index: Lib/test/test_codecmaps_hk.py =================================================================== --- Lib/test/test_codecmaps_hk.py (revision 62290) +++ Lib/test/test_codecmaps_hk.py (working copy) @@ -4,7 +4,7 @@ # Codec mapping tests for HongKong encodings # -from test import test_support +from test import support from test import test_multibytecodec_support import unittest @@ -14,8 +14,8 @@ mapfileurl = 'http://people.freebsd.org/~perky/i18n/BIG5HKSCS-2004.TXT' def test_main(): - test_support.run_unittest(__name__) + support.run_unittest(__name__) if __name__ == "__main__": - test_support.use_resources = ['urlfetch'] + support.use_resources = ['urlfetch'] test_main() Index: Lib/test/double_const.py =================================================================== --- Lib/test/double_const.py (revision 62290) +++ Lib/test/double_const.py (working copy) @@ -1,4 +1,4 @@ -from test.test_support import TestFailed +from test.support import TestFailed # A test for SF bug 422177: manifest float constants varied way too much in # precision depending on whether Python was loading a module for the first Index: Lib/test/test_pkg.py =================================================================== --- Lib/test/test_pkg.py (revision 62290) +++ Lib/test/test_pkg.py (working copy) @@ -5,7 +5,7 @@ import tempfile import textwrap import unittest -from test import test_support +from test import support # Helpers to create and destroy hierarchies. @@ -266,7 +266,7 @@ def test_main(): - test_support.run_unittest(__name__) + support.run_unittest(__name__) if __name__ == "__main__": Index: Lib/test/test_complex_args.py =================================================================== --- Lib/test/test_complex_args.py (revision 62290) +++ Lib/test/test_complex_args.py (working copy) @@ -1,6 +1,6 @@ import unittest -from test import test_support +from test import support class ComplexArgsTestCase(unittest.TestCase): @@ -85,7 +85,7 @@ def test_main(): - test_support.run_unittest(ComplexArgsTestCase) + support.run_unittest(ComplexArgsTestCase) if __name__ == "__main__": test_main() Index: Lib/test/test_itertools.py =================================================================== --- Lib/test/test_itertools.py (revision 62290) +++ Lib/test/test_itertools.py (working copy) @@ -1,11 +1,11 @@ import unittest -from test import test_support +from test import support from itertools import * from weakref import proxy import sys import operator import random -maxsize = test_support.MAX_Py_ssize_t +maxsize = support.MAX_Py_ssize_t minsize = -maxsize-1 def onearg(x): @@ -1370,20 +1370,20 @@ test_classes = (TestBasicOps, TestVariousIteratorArgs, TestGC, RegressionTests, LengthTransparency, SubclassWithKwargsTest, TestExamples) - test_support.run_unittest(*test_classes) + support.run_unittest(*test_classes) # verify reference counting if verbose and hasattr(sys, "gettotalrefcount"): import gc counts = [None] * 5 for i in xrange(len(counts)): - test_support.run_unittest(*test_classes) + support.run_unittest(*test_classes) gc.collect() counts[i] = sys.gettotalrefcount() print counts # doctest the examples in the library reference - test_support.run_doctest(sys.modules[__name__], verbose) + support.run_doctest(sys.modules[__name__], verbose) if __name__ == "__main__": test_main(verbose=True) Index: Lib/test/test_distutils.py =================================================================== --- Lib/test/test_distutils.py (revision 62290) +++ Lib/test/test_distutils.py (working copy) @@ -6,11 +6,11 @@ """ import distutils.tests -import test.test_support +import test.support def test_main(): - test.test_support.run_unittest(distutils.tests.test_suite()) + test.support.run_unittest(distutils.tests.test_suite()) if __name__ == "__main__": Index: Lib/test/test_imp.py =================================================================== --- Lib/test/test_imp.py (revision 62290) +++ Lib/test/test_imp.py (working copy) @@ -1,6 +1,6 @@ import imp import unittest -from test import test_support +from test import support class LockTests(unittest.TestCase): @@ -38,7 +38,7 @@ "RuntimeError") def test_main(): - test_support.run_unittest( + support.run_unittest( LockTests, ) Index: Lib/test/test_unicode.py =================================================================== --- Lib/test/test_unicode.py (revision 62290) +++ Lib/test/test_unicode.py (working copy) @@ -7,7 +7,7 @@ """#" import sys, struct, codecs -from test import test_support, string_tests +from test import support, string_tests # Error handling (bad decoder return) def search_function(encoding): @@ -415,7 +415,7 @@ return u'\u1234' self.assertEqual('%s' % Wrapper(), u'\u1234') - @test_support.run_with_locale('LC_ALL', 'de_DE', 'fr_FR') + @support.run_with_locale('LC_ALL', 'de_DE', 'fr_FR') def test_format_float(self): # should not format with a comma, but always with C locale self.assertEqual(u'1.0', u'%.1f' % 1.0) @@ -1111,7 +1111,7 @@ self.assertRaises(UnicodeEncodeError, "foo{0}".format, u'\u1000bar') def test_main(): - test_support.run_unittest(__name__) + support.run_unittest(__name__) if __name__ == "__main__": test_main() Index: Lib/test/test_resource.py =================================================================== --- Lib/test/test_resource.py (revision 62290) +++ Lib/test/test_resource.py (working copy) @@ -1,5 +1,5 @@ import unittest -from test import test_support +from test import support import resource import time @@ -47,7 +47,7 @@ limit_set = True except ValueError: limit_set = False - f = open(test_support.TESTFN, "wb") + f = open(support.TESTFN, "wb") try: f.write("X" * 1024) try: @@ -73,7 +73,7 @@ finally: if limit_set: resource.setrlimit(resource.RLIMIT_FSIZE, (cur, max)) - test_support.unlink(test_support.TESTFN) + support.unlink(support.TESTFN) def test_fsize_toobig(self): # Be sure that setrlimit is checking for really large values @@ -104,7 +104,7 @@ pass def test_main(verbose=None): - test_support.run_unittest(ResourceTest) + support.run_unittest(ResourceTest) if __name__ == "__main__": test_main() Index: Lib/test/test_socket.py =================================================================== --- Lib/test/test_socket.py (revision 62290) +++ Lib/test/test_socket.py (working copy) @@ -1,7 +1,7 @@ #!/usr/bin/env python import unittest -from test import test_support +from test import support import errno import socket @@ -16,14 +16,14 @@ from weakref import proxy import signal -HOST = test_support.HOST +HOST = support.HOST MSG = 'Michael Gilfix was here\n' class SocketTCPTest(unittest.TestCase): def setUp(self): self.serv = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - self.port = test_support.bind_port(self.serv) + self.port = support.bind_port(self.serv) self.serv.listen(1) def tearDown(self): @@ -34,7 +34,7 @@ def setUp(self): self.serv = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) - self.port = test_support.bind_port(self.serv) + self.port = support.bind_port(self.serv) def tearDown(self): self.serv.close() @@ -844,7 +844,7 @@ class NetworkConnectionNoServer(unittest.TestCase): def testWithoutServer(self): - port = test_support.find_unused_port() + port = support.find_unused_port() self.failUnlessRaises( socket.error, lambda: socket.create_connection((HOST, port)) @@ -1115,7 +1115,7 @@ for line in f: if line.startswith("tipc "): return True - if test_support.verbose: + if support.verbose: print "TIPC module is not loaded, please 'sudo modprobe tipc'" return False @@ -1200,9 +1200,9 @@ tests.append(TIPCTest) tests.append(TIPCThreadableTest) - thread_info = test_support.threading_setup() - test_support.run_unittest(*tests) - test_support.threading_cleanup(*thread_info) + thread_info = support.threading_setup() + support.run_unittest(*tests) + support.threading_cleanup(*thread_info) if __name__ == "__main__": test_main() Index: Lib/test/test_genericpath.py =================================================================== --- Lib/test/test_genericpath.py (revision 62290) +++ Lib/test/test_genericpath.py (working copy) @@ -1,5 +1,5 @@ import unittest -from test import test_support +from test import support import os import genericpath @@ -27,114 +27,114 @@ ) def test_getsize(self): - f = open(test_support.TESTFN, "wb") + f = open(support.TESTFN, "wb") try: f.write("foo") f.close() - self.assertEqual(genericpath.getsize(test_support.TESTFN), 3) + self.assertEqual(genericpath.getsize(support.TESTFN), 3) finally: if not f.closed: f.close() - os.remove(test_support.TESTFN) + os.remove(support.TESTFN) def test_time(self): - f = open(test_support.TESTFN, "wb") + f = open(support.TESTFN, "wb") try: f.write("foo") f.close() - f = open(test_support.TESTFN, "ab") + f = open(support.TESTFN, "ab") f.write("bar") f.close() - f = open(test_support.TESTFN, "rb") + f = open(support.TESTFN, "rb") d = f.read() f.close() self.assertEqual(d, "foobar") self.assert_( - genericpath.getctime(test_support.TESTFN) <= - genericpath.getmtime(test_support.TESTFN) + genericpath.getctime(support.TESTFN) <= + genericpath.getmtime(support.TESTFN) ) finally: if not f.closed: f.close() - os.remove(test_support.TESTFN) + os.remove(support.TESTFN) def test_exists(self): - self.assertIs(genericpath.exists(test_support.TESTFN), False) - f = open(test_support.TESTFN, "wb") + self.assertIs(genericpath.exists(support.TESTFN), False) + f = open(support.TESTFN, "wb") try: f.write("foo") f.close() - self.assertIs(genericpath.exists(test_support.TESTFN), True) + self.assertIs(genericpath.exists(support.TESTFN), True) finally: if not f.close(): f.close() try: - os.remove(test_support.TESTFN) + os.remove(support.TESTFN) except os.error: pass self.assertRaises(TypeError, genericpath.exists) def test_isdir(self): - self.assertIs(genericpath.isdir(test_support.TESTFN), False) - f = open(test_support.TESTFN, "wb") + self.assertIs(genericpath.isdir(support.TESTFN), False) + f = open(support.TESTFN, "wb") try: f.write("foo") f.close() - self.assertIs(genericpath.isdir(test_support.TESTFN), False) - os.remove(test_support.TESTFN) - os.mkdir(test_support.TESTFN) - self.assertIs(genericpath.isdir(test_support.TESTFN), True) - os.rmdir(test_support.TESTFN) + self.assertIs(genericpath.isdir(support.TESTFN), False) + os.remove(support.TESTFN) + os.mkdir(support.TESTFN) + self.assertIs(genericpath.isdir(support.TESTFN), True) + os.rmdir(support.TESTFN) finally: if not f.close(): f.close() try: - os.remove(test_support.TESTFN) + os.remove(support.TESTFN) except os.error: pass try: - os.rmdir(test_support.TESTFN) + os.rmdir(support.TESTFN) except os.error: pass self.assertRaises(TypeError, genericpath.isdir) def test_isfile(self): - self.assertIs(genericpath.isfile(test_support.TESTFN), False) - f = open(test_support.TESTFN, "wb") + self.assertIs(genericpath.isfile(support.TESTFN), False) + f = open(support.TESTFN, "wb") try: f.write("foo") f.close() - self.assertIs(genericpath.isfile(test_support.TESTFN), True) - os.remove(test_support.TESTFN) - os.mkdir(test_support.TESTFN) - self.assertIs(genericpath.isfile(test_support.TESTFN), False) - os.rmdir(test_support.TESTFN) + self.assertIs(genericpath.isfile(support.TESTFN), True) + os.remove(support.TESTFN) + os.mkdir(support.TESTFN) + self.assertIs(genericpath.isfile(support.TESTFN), False) + os.rmdir(support.TESTFN) finally: if not f.close(): f.close() try: - os.remove(test_support.TESTFN) + os.remove(support.TESTFN) except os.error: pass try: - os.rmdir(test_support.TESTFN) + os.rmdir(support.TESTFN) except os.error: pass self.assertRaises(TypeError, genericpath.isdir) def test_samefile(self): - f = open(test_support.TESTFN + "1", "wb") + f = open(support.TESTFN + "1", "wb") try: f.write("foo") f.close() self.assertIs( genericpath.samefile( - test_support.TESTFN + "1", - test_support.TESTFN + "1" + support.TESTFN + "1", + support.TESTFN + "1" ), True ) @@ -142,24 +142,24 @@ # inode information and thus, that samefile() doesn't work if hasattr(os, "symlink"): os.symlink( - test_support.TESTFN + "1", - test_support.TESTFN + "2" + support.TESTFN + "1", + support.TESTFN + "2" ) self.assertIs( genericpath.samefile( - test_support.TESTFN + "1", - test_support.TESTFN + "2" + support.TESTFN + "1", + support.TESTFN + "2" ), True ) - os.remove(test_support.TESTFN + "2") - f = open(test_support.TESTFN + "2", "wb") + os.remove(support.TESTFN + "2") + f = open(support.TESTFN + "2", "wb") f.write("bar") f.close() self.assertIs( genericpath.samefile( - test_support.TESTFN + "1", - test_support.TESTFN + "2" + support.TESTFN + "1", + support.TESTFN + "2" ), False ) @@ -167,18 +167,18 @@ if not f.close(): f.close() try: - os.remove(test_support.TESTFN + "1") + os.remove(support.TESTFN + "1") except os.error: pass try: - os.remove(test_support.TESTFN + "2") + os.remove(support.TESTFN + "2") except os.error: pass self.assertRaises(TypeError, genericpath.samefile) def test_main(): - test_support.run_unittest(AllCommonTest) + support.run_unittest(AllCommonTest) if __name__=="__main__": test_main() Index: Lib/test/test_uu.py =================================================================== --- Lib/test/test_uu.py (revision 62290) +++ Lib/test/test_uu.py (working copy) @@ -4,7 +4,7 @@ """ import unittest -from test import test_support +from test import support import sys, os, uu, cStringIO import uu @@ -104,8 +104,8 @@ pass def setUp(self): - self.tmpin = test_support.TESTFN + "i" - self.tmpout = test_support.TESTFN + "o" + self.tmpin = support.TESTFN + "i" + self.tmpout = support.TESTFN + "o" def tearDown(self): del self.tmpin @@ -114,7 +114,7 @@ def test_encode(self): fin = fout = None try: - test_support.unlink(self.tmpin) + support.unlink(self.tmpin) fin = open(self.tmpin, 'wb') fin.write(plaintext) fin.close() @@ -144,7 +144,7 @@ def test_decode(self): f = None try: - test_support.unlink(self.tmpin) + support.unlink(self.tmpin) f = open(self.tmpin, 'w') f.write(encodedtextwrapped % (0644, self.tmpout)) f.close() @@ -178,7 +178,7 @@ self._kill(f) def test_main(): - test_support.run_unittest(UUTest, UUStdIOTest, UUFileTest) + support.run_unittest(UUTest, UUStdIOTest, UUFileTest) if __name__=="__main__": test_main() Index: Lib/test/test_docxmlrpc.py =================================================================== --- Lib/test/test_docxmlrpc.py (revision 62290) +++ Lib/test/test_docxmlrpc.py (working copy) @@ -1,6 +1,6 @@ from DocXMLRPCServer import DocXMLRPCServer import httplib -from test import test_support +from test import support import threading import time import unittest @@ -146,7 +146,7 @@ response.read()) def test_main(): - test_support.run_unittest(DocXMLRPCHTTPGETServer) + support.run_unittest(DocXMLRPCHTTPGETServer) if __name__ == '__main__': test_main() Index: Lib/test/test_getargs.py =================================================================== --- Lib/test/test_getargs.py (revision 62290) +++ Lib/test/test_getargs.py (working copy) @@ -14,21 +14,21 @@ import marshal import unittest -from test import test_support +from test import support class GetArgsTest(unittest.TestCase): # If the encoding succeeds using the current default encoding, # this test will fail because it does not test the right part of the # PyArg_ParseTuple() implementation. def test_with_marshal(self): - if not test_support.have_unicode: + if not support.have_unicode: return arg = unicode(r'\222', 'unicode-escape') self.assertRaises(UnicodeError, marshal.loads, arg) def test_main(): - test_support.run_unittest(GetArgsTest) + support.run_unittest(GetArgsTest) if __name__ == '__main__': test_main() Index: Lib/test/test_atexit.py =================================================================== --- Lib/test/test_atexit.py (revision 62290) +++ Lib/test/test_atexit.py (working copy) @@ -2,7 +2,7 @@ import unittest import StringIO import atexit -from test import test_support +from test import support class TestCase(unittest.TestCase): def test_args(self): @@ -93,7 +93,7 @@ raise SystemError def test_main(): - test_support.run_unittest(TestCase) + support.run_unittest(TestCase) if __name__ == "__main__": Index: Lib/test/test_fileinput.py =================================================================== --- Lib/test/test_fileinput.py (revision 62290) +++ Lib/test/test_fileinput.py (working copy) @@ -4,8 +4,8 @@ ''' import unittest -from test.test_support import verbose, TESTFN, run_unittest -from test.test_support import unlink as safe_unlink +from test.support import verbose, TESTFN, run_unittest +from test.support import unlink as safe_unlink import sys, re from StringIO import StringIO from fileinput import FileInput, hook_encoded Index: Lib/test/test_dl.py =================================================================== --- Lib/test/test_dl.py (revision 62290) +++ Lib/test/test_dl.py (working copy) @@ -4,7 +4,7 @@ """ import dl -from test.test_support import verbose,TestSkipped +from test.support import verbose,TestSkipped sharedlibs = [ ('/usr/lib/libc.so', 'getpid'), Index: Lib/test/test_getopt.py =================================================================== --- Lib/test/test_getopt.py (revision 62290) +++ Lib/test/test_getopt.py (working copy) @@ -1,7 +1,7 @@ # test_getopt.py # David Goodger 2000-08-19 -from test.test_support import verbose, run_doctest, run_unittest +from test.support import verbose, run_doctest, run_unittest import unittest import getopt Index: Lib/test/test_transformer.py =================================================================== --- Lib/test/test_transformer.py (revision 62290) +++ Lib/test/test_transformer.py (working copy) @@ -1,5 +1,5 @@ import unittest -from test import test_support +from test import support from compiler import transformer, ast from compiler import compile @@ -29,7 +29,7 @@ assert vals['b'] == 2 def test_main(): - test_support.run_unittest(Tests) + support.run_unittest(Tests) if __name__ == "__main__": test_main() Index: Lib/test/test_applesingle.py =================================================================== --- Lib/test/test_applesingle.py (revision 62290) +++ Lib/test/test_applesingle.py (working copy) @@ -5,7 +5,7 @@ import Carbon.File import MacOS import os -from test import test_support +from test import support import struct import applesingle @@ -19,18 +19,18 @@ 2, 50+len(dataforkdata), len(resourceforkdata)) + \ dataforkdata + \ resourceforkdata -TESTFN2 = test_support.TESTFN + '2' +TESTFN2 = support.TESTFN + '2' class TestApplesingle(unittest.TestCase): def setUp(self): - fp = open(test_support.TESTFN, 'w') + fp = open(support.TESTFN, 'w') fp.write(applesingledata) fp.close() def tearDown(self): try: - os.unlink(test_support.TESTFN) + os.unlink(support.TESTFN) except: pass try: @@ -51,7 +51,7 @@ os.unlink(TESTFN2) except: pass - applesingle.decode(test_support.TESTFN, TESTFN2) + applesingle.decode(support.TESTFN, TESTFN2) self.compareData(False, dataforkdata) self.compareData(True, resourceforkdata) @@ -60,11 +60,11 @@ os.unlink(TESTFN2) except: pass - applesingle.decode(test_support.TESTFN, TESTFN2, resonly=True) + applesingle.decode(support.TESTFN, TESTFN2, resonly=True) self.compareData(False, resourceforkdata) def test_main(): - test_support.run_unittest(TestApplesingle) + support.run_unittest(TestApplesingle) if __name__ == '__main__': Index: Lib/test/test_float.py =================================================================== --- Lib/test/test_float.py (revision 62290) +++ Lib/test/test_float.py (working copy) @@ -1,7 +1,7 @@ import unittest, struct import os -from test import test_support +from test import support def isinf(x): return x * 0.5 == x @@ -207,7 +207,7 @@ self.assertEqual(str(-1e300 * 1e300 * 0), "nan") def test_main(): - test_support.run_unittest( + support.run_unittest( FormatFunctionsTestCase, UnknownFormatTestCase, IEEEFormatTestCase, Index: Lib/test/test_pow.py =================================================================== --- Lib/test/test_pow.py (revision 62290) +++ Lib/test/test_pow.py (working copy) @@ -1,4 +1,4 @@ -import test.test_support, unittest +import test.support, unittest class PowTest(unittest.TestCase): @@ -123,7 +123,7 @@ eq(expected, 1.0) # else we didn't push fiveto to evenness def test_main(): - test.test_support.run_unittest(PowTest) + test.support.run_unittest(PowTest) if __name__ == "__main__": test_main() Index: Lib/test/test_int_literal.py =================================================================== --- Lib/test/test_int_literal.py (revision 62290) +++ Lib/test/test_int_literal.py (working copy) @@ -4,7 +4,7 @@ """ import unittest -from test import test_support +from test import support import warnings warnings.filterwarnings("ignore", "hex/oct constants", FutureWarning, @@ -185,7 +185,7 @@ self.assertEqual(-0b1111111111111111111111111111111111111111111111111111111111111111, -18446744073709551615L) def test_main(): - test_support.run_unittest(TestHexOctBin) + support.run_unittest(TestHexOctBin) if __name__ == "__main__": test_main() Index: Lib/test/test_poll.py =================================================================== --- Lib/test/test_poll.py (revision 62290) +++ Lib/test/test_poll.py (working copy) @@ -1,7 +1,7 @@ # Test case for the os.poll() function import os, select, random, unittest -from test.test_support import TestSkipped, TESTFN, run_unittest +from test.support import TestSkipped, TESTFN, run_unittest try: select.poll Index: Lib/test/test_string.py =================================================================== --- Lib/test/test_string.py (revision 62290) +++ Lib/test/test_string.py (working copy) @@ -1,5 +1,5 @@ import unittest, string -from test import test_support, string_tests +from test import support, string_tests from UserList import UserList class StringTest( @@ -35,7 +35,7 @@ self.checkequal('w x y z', string_tests.Sequence(), 'join', ' ') self.checkequal('abc', ('abc',), 'join', 'a') self.checkequal('z', UserList(['z']), 'join', 'a') - if test_support.have_unicode: + if support.have_unicode: self.checkequal(unicode('a.b.c'), ['a', 'b', 'c'], 'join', unicode('.')) self.checkequal(unicode('a.b.c'), [unicode('a'), 'b', 'c'], 'join', '.') self.checkequal(unicode('a.b.c'), ['a', unicode('b'), 'c'], 'join', '.') @@ -204,7 +204,7 @@ self.assert_(type(br""), str) def test_main(): - test_support.run_unittest(StringTest, ModuleTest, BytesAliasTest) + support.run_unittest(StringTest, ModuleTest, BytesAliasTest) if __name__ == "__main__": test_main() Index: Lib/test/test_shutil.py =================================================================== --- Lib/test/test_shutil.py (revision 62290) +++ Lib/test/test_shutil.py (working copy) @@ -7,8 +7,8 @@ import stat import os import os.path -from test import test_support -from test.test_support import TESTFN +from test import support +from test.support import TESTFN class TestShutil(unittest.TestCase): def test_rmtree_errors(self): @@ -267,7 +267,7 @@ def test_main(): - test_support.run_unittest(TestShutil, TestMove) + support.run_unittest(TestShutil, TestMove) if __name__ == '__main__': test_main() Index: Lib/test/test_genexps.py =================================================================== --- Lib/test/test_genexps.py (revision 62290) +++ Lib/test/test_genexps.py (working copy) @@ -262,16 +262,16 @@ def test_main(verbose=None): import sys - from test import test_support + from test import support from test import test_genexps - test_support.run_doctest(test_genexps, verbose) + support.run_doctest(test_genexps, verbose) # verify reference counting if verbose and hasattr(sys, "gettotalrefcount"): import gc counts = [None] * 5 for i in xrange(len(counts)): - test_support.run_doctest(test_genexps, verbose) + support.run_doctest(test_genexps, verbose) gc.collect() counts[i] = sys.gettotalrefcount() print counts Index: Lib/test/test_sha.py =================================================================== --- Lib/test/test_sha.py (revision 62290) +++ Lib/test/test_sha.py (working copy) @@ -10,7 +10,7 @@ import sha import unittest -from test import test_support +from test import support class SHATestCase(unittest.TestCase): @@ -49,7 +49,7 @@ '4ca0ef38f1794b28a8f8ee110ee79d48ce13be25') def test_main(): - test_support.run_unittest(SHATestCase) + support.run_unittest(SHATestCase) if __name__ == "__main__": Index: Lib/test/test_with.py =================================================================== --- Lib/test/test_with.py (revision 62290) +++ Lib/test/test_with.py (working copy) @@ -11,7 +11,7 @@ import unittest from collections import deque from contextlib import GeneratorContextManager, contextmanager -from test.test_support import run_unittest +from test.support import run_unittest class MockContextManager(GeneratorContextManager): Index: Lib/test/test_py3kwarn.py =================================================================== --- Lib/test/test_py3kwarn.py (revision 62290) +++ Lib/test/test_py3kwarn.py (working copy) @@ -1,6 +1,6 @@ import unittest import sys -from test.test_support import (catch_warning, TestSkipped, run_unittest, +from test.support import (catch_warning, TestSkipped, run_unittest, TestSkipped) import warnings Index: Lib/test/test_file.py =================================================================== --- Lib/test/test_file.py (revision 62290) +++ Lib/test/test_file.py (working copy) @@ -7,8 +7,8 @@ from array import array from weakref import proxy -from test import test_support -from test.test_support import TESTFN, findfile, run_unittest +from test import support +from test.support import TESTFN, findfile, run_unittest from UserList import UserList class AutoFileTests(unittest.TestCase): @@ -399,7 +399,7 @@ time.sleep(duration/100) with self._count_lock: if self.close_count-self.close_success_count > nb_workers+1: - if test_support.verbose: + if support.verbose: print 'Q', break time.sleep(duration) @@ -423,7 +423,7 @@ except (IOError, ValueError): pass self._run_workers(worker, nb_workers) - if test_support.verbose: + if support.verbose: # Useful verbose statistics when tuning this test to take # less time to run but still ensuring that its still useful. # Index: Lib/test/test_shlex.py =================================================================== --- Lib/test/test_shlex.py (revision 62290) +++ Lib/test/test_shlex.py (working copy) @@ -2,7 +2,7 @@ import unittest import shlex -from test import test_support +from test import support try: from cStringIO import StringIO @@ -185,7 +185,7 @@ delattr(ShlexTest, methname) def test_main(): - test_support.run_unittest(ShlexTest) + support.run_unittest(ShlexTest) if __name__ == "__main__": test_main() Index: Lib/test/test_logging.py =================================================================== --- Lib/test/test_logging.py (revision 62290) +++ Lib/test/test_logging.py (working copy) @@ -38,7 +38,7 @@ import struct import sys import tempfile -from test.test_support import captured_stdout, run_with_locale, run_unittest +from test.support import captured_stdout, run_with_locale, run_unittest import textwrap import threading import time Index: Lib/test/test_email.py =================================================================== --- Lib/test/test_email.py (revision 62290) +++ Lib/test/test_email.py (working copy) @@ -3,10 +3,10 @@ # The specific tests now live in Lib/email/test from email.test.test_email import suite -from test import test_support +from test import support def test_main(): - test_support.run_unittest(suite()) + support.run_unittest(suite()) if __name__ == '__main__': test_main() Index: Lib/test/test_threadsignals.py =================================================================== --- Lib/test/test_threadsignals.py (revision 62290) +++ Lib/test/test_threadsignals.py (working copy) @@ -5,7 +5,7 @@ import signal import os import sys -from test.test_support import run_unittest, TestSkipped +from test.support import run_unittest, TestSkipped if sys.platform[:3] in ('win', 'os2') or sys.platform=='riscos': raise TestSkipped, "Can't test signal on %s" % sys.platform Index: Lib/test/test_gc.py =================================================================== --- Lib/test/test_gc.py (revision 62290) +++ Lib/test/test_gc.py (working copy) @@ -1,5 +1,5 @@ import unittest -from test.test_support import verbose, run_unittest +from test.support import verbose, run_unittest import sys import gc import weakref Index: Lib/test/test_codecmaps_kr.py =================================================================== --- Lib/test/test_codecmaps_kr.py (revision 62290) +++ Lib/test/test_codecmaps_kr.py (working copy) @@ -4,7 +4,7 @@ # Codec mapping tests for ROK encodings # -from test import test_support +from test import support from test import test_multibytecodec_support import unittest @@ -38,7 +38,7 @@ pass_dectest = [('\\', u'\u20a9')] def test_main(): - test_support.run_unittest(__name__) + support.run_unittest(__name__) if __name__ == "__main__": test_main() Index: Lib/test/test_pyclbr.py =================================================================== --- Lib/test/test_pyclbr.py (revision 62290) +++ Lib/test/test_pyclbr.py (working copy) @@ -2,7 +2,7 @@ Test cases for pyclbr.py Nick Mathewson ''' -from test.test_support import run_unittest +from test.support import run_unittest import sys from types import ClassType, FunctionType, MethodType, BuiltinFunctionType import pyclbr Index: Lib/test/test_print.py =================================================================== --- Lib/test/test_print.py (revision 62290) +++ Lib/test/test_print.py (working copy) @@ -6,7 +6,7 @@ from __future__ import print_function import unittest -from test import test_support +from test import support import sys if sys.version_info[0] == 3: @@ -62,7 +62,7 @@ end is not NotDefined, file is not NotDefined)] - with test_support.captured_stdout() as t: + with support.captured_stdout() as t: fn(args, sep, end, file) self.assertEqual(t.getvalue(), expected) @@ -113,7 +113,7 @@ self.assertRaises(AttributeError, print, '', file='') def test_main(): - test_support.run_unittest(TestPrint) + support.run_unittest(TestPrint) if __name__ == "__main__": test_main() Index: Lib/test/test_heapq.py =================================================================== --- Lib/test/test_heapq.py (revision 62290) +++ Lib/test/test_heapq.py (working copy) @@ -2,7 +2,7 @@ import random import unittest -from test import test_support +from test import support import sys # We do a bit of trickery here to be able to test both the C implementation @@ -351,14 +351,14 @@ from types import BuiltinFunctionType test_classes = [TestHeapPython, TestHeapC, TestErrorHandling] - test_support.run_unittest(*test_classes) + support.run_unittest(*test_classes) # verify reference counting if verbose and hasattr(sys, "gettotalrefcount"): import gc counts = [None] * 5 for i in xrange(len(counts)): - test_support.run_unittest(*test_classes) + support.run_unittest(*test_classes) gc.collect() counts[i] = sys.gettotalrefcount() print counts Index: Lib/test/test_StringIO.py =================================================================== --- Lib/test/test_StringIO.py (revision 62290) +++ Lib/test/test_StringIO.py (working copy) @@ -4,7 +4,7 @@ import StringIO import cStringIO import types -from test import test_support +from test import support class TestGenericStringIO(unittest.TestCase): @@ -103,7 +103,7 @@ def test_unicode(self): - if not test_support.have_unicode: return + if not support.have_unicode: return # The StringIO module also supports concatenating Unicode # snippets to larger Unicode strings. This is tested by this @@ -135,7 +135,7 @@ def test_main(): - test_support.run_unittest( + support.run_unittest( TestStringIO, TestcStringIO, TestBufferStringIO, Index: Lib/test/test_long.py =================================================================== --- Lib/test/test_long.py (revision 62290) +++ Lib/test/test_long.py (working copy) @@ -1,5 +1,5 @@ import unittest -from test import test_support +from test import support import random @@ -501,7 +501,7 @@ self.assertEqual(long(float('nan')), 0L) def test_main(): - test_support.run_unittest(LongTest) + support.run_unittest(LongTest) if __name__ == "__main__": test_main() Index: Lib/test/test_profile.py =================================================================== --- Lib/test/test_profile.py (revision 62290) +++ Lib/test/test_profile.py (working copy) @@ -5,7 +5,7 @@ import pstats import unittest from StringIO import StringIO -from test.test_support import run_unittest +from test.support import run_unittest import profile from test.profilee import testfunc, timer Index: Lib/test/test_dbm.py =================================================================== --- Lib/test/test_dbm.py (revision 62290) +++ Lib/test/test_dbm.py (working copy) @@ -1,4 +1,4 @@ -from test import test_support +from test import support import unittest import os import random @@ -8,13 +8,13 @@ class DbmTestCase(unittest.TestCase): def setUp(self): - self.filename = test_support.TESTFN + self.filename = support.TESTFN self.d = dbm.open(self.filename, 'c') self.d.close() def tearDown(self): for suffix in ['', '.pag', '.dir', '.db']: - test_support.unlink(self.filename + suffix) + support.unlink(self.filename + suffix) def test_keys(self): self.d = dbm.open(self.filename, 'c') @@ -34,7 +34,7 @@ self.fail() def test_main(): - test_support.run_unittest(DbmTestCase) + support.run_unittest(DbmTestCase) if __name__ == '__main__': test_main() Index: Lib/test/test_typechecks.py =================================================================== --- Lib/test/test_typechecks.py (revision 62290) +++ Lib/test/test_typechecks.py (working copy) @@ -1,7 +1,7 @@ """Unit tests for __instancecheck__ and __subclasscheck__.""" import unittest -from test import test_support +from test import support class ABC(type): @@ -70,7 +70,7 @@ def test_main(): - test_support.run_unittest(TypeChecksTest) + support.run_unittest(TypeChecksTest) if __name__ == "__main__": Index: Lib/test/test_cprofile.py =================================================================== --- Lib/test/test_cprofile.py (revision 62290) +++ Lib/test/test_cprofile.py (working copy) @@ -1,7 +1,7 @@ """Test suite for the cProfile module.""" import sys -from test.test_support import run_unittest +from test.support import run_unittest # rip off all interesting stuff from test_profile import cProfile Index: Lib/test/test___future__.py =================================================================== --- Lib/test/test___future__.py (revision 62290) +++ Lib/test/test___future__.py (working copy) @@ -1,6 +1,6 @@ #! /usr/bin/env python import unittest -from test import test_support +from test import support import __future__ GOOD_SERIALS = ("alpha", "beta", "candidate", "final") @@ -57,7 +57,7 @@ ".compiler_flag isn't int") def test_main(): - test_support.run_unittest(FutureTest) + support.run_unittest(FutureTest) if __name__ == "__main__": test_main() Index: Lib/test/test_gzip.py =================================================================== --- Lib/test/test_gzip.py (revision 62290) +++ Lib/test/test_gzip.py (working copy) @@ -3,7 +3,7 @@ """ import unittest -from test import test_support +from test import support import os import gzip @@ -22,13 +22,13 @@ class TestGzip(unittest.TestCase): - filename = test_support.TESTFN + filename = support.TESTFN def setUp (self): - test_support.unlink(self.filename) + support.unlink(self.filename) def tearDown (self): - test_support.unlink(self.filename) + support.unlink(self.filename) def test_write (self): @@ -158,7 +158,7 @@ f.close() def test_main(verbose=None): - test_support.run_unittest(TestGzip) + support.run_unittest(TestGzip) if __name__ == "__main__": test_main(verbose=True) Index: Lib/test/test_charmapcodec.py =================================================================== --- Lib/test/test_charmapcodec.py (revision 62290) +++ Lib/test/test_charmapcodec.py (working copy) @@ -9,7 +9,7 @@ """#" -import test.test_support, unittest +import test.support, unittest import codecs @@ -50,7 +50,7 @@ self.assertRaises(UnicodeError, unicode, 'abc\001', codecname) def test_main(): - test.test_support.run_unittest(CharmapCodecTest) + test.support.run_unittest(CharmapCodecTest) if __name__ == "__main__": test_main() Index: Lib/test/test_future.py =================================================================== --- Lib/test/test_future.py (revision 62290) +++ Lib/test/test_future.py (working copy) @@ -1,7 +1,7 @@ # Test various flavors of legal and illegal future statements import unittest -from test import test_support +from test import support import re rx = re.compile('\((\S+).py, line (\d+)') @@ -13,17 +13,17 @@ class FutureTest(unittest.TestCase): def test_future1(self): - test_support.unload('test_future1') + support.unload('test_future1') from test import test_future1 self.assertEqual(test_future1.result, 6) def test_future2(self): - test_support.unload('test_future2') + support.unload('test_future2') from test import test_future2 self.assertEqual(test_future2.result, 6) def test_future3(self): - test_support.unload('test_future3') + support.unload('test_future3') from test import test_future3 def test_badfuture3(self): @@ -104,7 +104,7 @@ def test_main(): - test_support.run_unittest(FutureTest) + support.run_unittest(FutureTest) if __name__ == "__main__": test_main() Index: Lib/test/test_cmd_line.py =================================================================== --- Lib/test/test_cmd_line.py (revision 62290) +++ Lib/test/test_cmd_line.py (working copy) @@ -2,7 +2,7 @@ # All tests are executed with environment variables ignored # See test_cmd_line_script.py for testing of script execution -import test.test_support, unittest +import test.support, unittest import sys import subprocess @@ -105,8 +105,8 @@ def test_main(): - test.test_support.run_unittest(CmdLineTest) - test.test_support.reap_children() + test.support.run_unittest(CmdLineTest) + test.support.reap_children() if __name__ == "__main__": test_main() Index: Lib/test/test_longexp.py =================================================================== --- Lib/test/test_longexp.py (revision 62290) +++ Lib/test/test_longexp.py (working copy) @@ -1,5 +1,5 @@ import unittest -from test import test_support +from test import support class LongExpText(unittest.TestCase): def test_longexp(self): @@ -8,7 +8,7 @@ self.assertEqual(len(l), REPS) def test_main(): - test_support.run_unittest(LongExpText) + support.run_unittest(LongExpText) if __name__=="__main__": test_main() Index: Lib/test/test_imgfile.py =================================================================== --- Lib/test/test_imgfile.py (revision 62290) +++ Lib/test/test_imgfile.py (working copy) @@ -4,7 +4,7 @@ Roger E. Masse """ -from test.test_support import verbose, unlink, findfile +from test.support import verbose, unlink, findfile import imgfile, uu Index: Lib/test/test_functools.py =================================================================== --- Lib/test/test_functools.py (revision 62290) +++ Lib/test/test_functools.py (working copy) @@ -1,6 +1,6 @@ import functools import unittest -from test import test_support +from test import support from weakref import proxy @staticmethod @@ -277,14 +277,14 @@ TestUpdateWrapper, TestWraps ) - test_support.run_unittest(*test_classes) + support.run_unittest(*test_classes) # verify reference counting if verbose and hasattr(sys, "gettotalrefcount"): import gc counts = [None] * 5 for i in xrange(len(counts)): - test_support.run_unittest(*test_classes) + support.run_unittest(*test_classes) gc.collect() counts[i] = sys.gettotalrefcount() print counts Index: Lib/test/test_colorsys.py =================================================================== --- Lib/test/test_colorsys.py (revision 62290) +++ Lib/test/test_colorsys.py (working copy) @@ -1,4 +1,4 @@ -import unittest, test.test_support +import unittest, test.support import colorsys def frange(start, stop, step): @@ -70,7 +70,7 @@ self.assertTripleEqual(rgb, colorsys.hls_to_rgb(*hls)) def test_main(): - test.test_support.run_unittest(ColorsysTest) + test.support.run_unittest(ColorsysTest) if __name__ == "__main__": test_main() Index: Lib/test/test_runpy.py =================================================================== --- Lib/test/test_runpy.py (revision 62290) +++ Lib/test/test_runpy.py (working copy) @@ -4,7 +4,7 @@ import os.path import sys import tempfile -from test.test_support import verbose, run_unittest, forget +from test.support import verbose, run_unittest, forget from runpy import _run_code, _run_module_code, run_module # Note: This module can't safely test _run_module_as_main as it Index: Lib/test/test_pstats.py =================================================================== --- Lib/test/test_pstats.py (revision 62290) +++ Lib/test/test_pstats.py (working copy) @@ -1,5 +1,5 @@ import unittest -from test import test_support +from test import support import pstats @@ -17,7 +17,7 @@ def test_main(): - test_support.run_unittest( + support.run_unittest( AddCallersTestCase ) Index: Lib/test/test_os.py =================================================================== --- Lib/test/test_os.py (revision 62290) +++ Lib/test/test_os.py (working copy) @@ -6,7 +6,7 @@ import unittest import warnings import sys -from test import test_support +from test import support warnings.filterwarnings("ignore", "tempnam", RuntimeWarning, __name__) warnings.filterwarnings("ignore", "tmpnam", RuntimeWarning, __name__) @@ -14,17 +14,17 @@ # Tests creating TESTFN class FileTests(unittest.TestCase): def setUp(self): - if os.path.exists(test_support.TESTFN): - os.unlink(test_support.TESTFN) + if os.path.exists(support.TESTFN): + os.unlink(support.TESTFN) tearDown = setUp def test_access(self): - f = os.open(test_support.TESTFN, os.O_CREAT|os.O_RDWR) + f = os.open(support.TESTFN, os.O_CREAT|os.O_RDWR) os.close(f) - self.assert_(os.access(test_support.TESTFN, os.W_OK)) + self.assert_(os.access(support.TESTFN, os.W_OK)) def test_closerange(self): - f = os.open(test_support.TESTFN, os.O_CREAT|os.O_RDWR) + f = os.open(support.TESTFN, os.O_CREAT|os.O_RDWR) # close a fd that is open, and one that isn't os.closerange(f, f+2) self.assertRaises(OSError, os.write, f, "a") @@ -33,12 +33,12 @@ class TemporaryFileTests(unittest.TestCase): def setUp(self): self.files = [] - os.mkdir(test_support.TESTFN) + os.mkdir(support.TESTFN) def tearDown(self): for name in self.files: os.unlink(name) - os.rmdir(test_support.TESTFN) + os.rmdir(support.TESTFN) def check_tempfile(self, name): # make sure it doesn't already exist: @@ -55,10 +55,10 @@ r"test_os$") self.check_tempfile(os.tempnam()) - name = os.tempnam(test_support.TESTFN) + name = os.tempnam(support.TESTFN) self.check_tempfile(name) - name = os.tempnam(test_support.TESTFN, "pfx") + name = os.tempnam(support.TESTFN, "pfx") self.assert_(os.path.basename(name)[:3] == "pfx") self.check_tempfile(name) @@ -141,15 +141,15 @@ # Test attributes on return values from os.*stat* family. class StatAttributeTests(unittest.TestCase): def setUp(self): - os.mkdir(test_support.TESTFN) - self.fname = os.path.join(test_support.TESTFN, "f1") + os.mkdir(support.TESTFN) + self.fname = os.path.join(support.TESTFN, "f1") f = open(self.fname, 'wb') f.write("ABC") f.close() def tearDown(self): os.unlink(self.fname) - os.rmdir(test_support.TESTFN) + os.rmdir(support.TESTFN) def test_stat_attributes(self): if not hasattr(os, "stat"): @@ -269,11 +269,11 @@ def test_utime_dir(self): delta = 1000000 - st = os.stat(test_support.TESTFN) + st = os.stat(support.TESTFN) # round to int, because some systems may support sub-second # time stamps in stat, but not in utime. - os.utime(test_support.TESTFN, (st.st_atime, int(st.st_mtime-delta))) - st2 = os.stat(test_support.TESTFN) + os.utime(support.TESTFN, (st.st_atime, int(st.st_mtime-delta))) + st2 = os.stat(support.TESTFN) self.assertEquals(st2.st_mtime, int(st.st_mtime-delta)) # Restrict test to Win32, since there is no guarantee other @@ -288,7 +288,7 @@ if kernel32.GetVolumeInformationA(root, None, 0, None, None, None, buf, len(buf)): return buf.value - if get_file_system(test_support.TESTFN) == "NTFS": + if get_file_system(support.TESTFN) == "NTFS": def test_1565150(self): t1 = 1159195039.25 os.utime(self.fname, (t1, t1)) @@ -346,7 +346,7 @@ # link/ a symlink to TESTFN.2 # TEST2/ # tmp4 a lone file - walk_path = join(test_support.TESTFN, "TEST1") + walk_path = join(support.TESTFN, "TEST1") sub1_path = join(walk_path, "SUB1") sub11_path = join(sub1_path, "SUB11") sub2_path = join(walk_path, "SUB2") @@ -354,8 +354,8 @@ tmp2_path = join(sub1_path, "tmp2") tmp3_path = join(sub2_path, "tmp3") link_path = join(sub2_path, "link") - t2_path = join(test_support.TESTFN, "TEST2") - tmp4_path = join(test_support.TESTFN, "TEST2", "tmp4") + t2_path = join(support.TESTFN, "TEST2") + tmp4_path = join(support.TESTFN, "TEST2", "tmp4") # Create stuff. os.makedirs(sub11_path) @@ -424,7 +424,7 @@ # Windows, which doesn't have a recursive delete command. The # (not so) subtlety is that rmdir will fail unless the dir's # kids are removed first, so bottom up is essential. - for root, dirs, files in os.walk(test_support.TESTFN, topdown=False): + for root, dirs, files in os.walk(support.TESTFN, topdown=False): for name in files: os.remove(os.path.join(root, name)) for name in dirs: @@ -433,14 +433,14 @@ os.rmdir(dirname) else: os.remove(dirname) - os.rmdir(test_support.TESTFN) + os.rmdir(support.TESTFN) class MakedirTests (unittest.TestCase): def setUp(self): - os.mkdir(test_support.TESTFN) + os.mkdir(support.TESTFN) def test_makedir(self): - base = test_support.TESTFN + base = support.TESTFN path = os.path.join(base, 'dir1', 'dir2', 'dir3') os.makedirs(path) # Should work path = os.path.join(base, 'dir1', 'dir2', 'dir3', 'dir4') @@ -458,12 +458,12 @@ def tearDown(self): - path = os.path.join(test_support.TESTFN, 'dir1', 'dir2', 'dir3', + path = os.path.join(support.TESTFN, 'dir1', 'dir2', 'dir3', 'dir4', 'dir5', 'dir6') # If the tests failed, the bottom-most directory ('../dir6') # may not have been created, so we look for the outermost directory # that exists. - while not os.path.exists(path) and path != test_support.TESTFN: + while not os.path.exists(path) and path != support.TESTFN: path = os.path.dirname(path) os.removedirs(path) @@ -489,32 +489,32 @@ class Win32ErrorTests(unittest.TestCase): def test_rename(self): - self.assertRaises(WindowsError, os.rename, test_support.TESTFN, test_support.TESTFN+".bak") + self.assertRaises(WindowsError, os.rename, support.TESTFN, support.TESTFN+".bak") def test_remove(self): - self.assertRaises(WindowsError, os.remove, test_support.TESTFN) + self.assertRaises(WindowsError, os.remove, support.TESTFN) def test_chdir(self): - self.assertRaises(WindowsError, os.chdir, test_support.TESTFN) + self.assertRaises(WindowsError, os.chdir, support.TESTFN) def test_mkdir(self): - self.assertRaises(WindowsError, os.chdir, test_support.TESTFN) + self.assertRaises(WindowsError, os.chdir, support.TESTFN) def test_utime(self): - self.assertRaises(WindowsError, os.utime, test_support.TESTFN, None) + self.assertRaises(WindowsError, os.utime, support.TESTFN, None) def test_access(self): - self.assertRaises(WindowsError, os.utime, test_support.TESTFN, 0) + self.assertRaises(WindowsError, os.utime, support.TESTFN, 0) def test_chmod(self): - self.assertRaises(WindowsError, os.utime, test_support.TESTFN, 0) + self.assertRaises(WindowsError, os.utime, support.TESTFN, 0) if sys.platform != 'win32': class Win32ErrorTests(unittest.TestCase): pass def test_main(): - test_support.run_unittest( + support.run_unittest( FileTests, TemporaryFileTests, StatAttributeTests, Index: Lib/test/test_unpack.py =================================================================== --- Lib/test/test_unpack.py (revision 62290) +++ Lib/test/test_unpack.py (working copy) @@ -122,9 +122,9 @@ __test__ = {'doctests' : doctests} def test_main(verbose=False): - from test import test_support + from test import support from test import test_unpack - test_support.run_doctest(test_unpack, verbose) + support.run_doctest(test_unpack, verbose) if __name__ == "__main__": test_main(verbose=True) Index: Lib/test/test_plistlib.py =================================================================== --- Lib/test/test_plistlib.py (revision 62290) +++ Lib/test/test_plistlib.py (working copy) @@ -4,7 +4,7 @@ import plistlib import os import datetime -from test import test_support +from test import support # This test data was generated through Cocoa's NSDictionary class @@ -91,7 +91,7 @@ def tearDown(self): try: - os.unlink(test_support.TESTFN) + os.unlink(support.TESTFN) except: pass @@ -123,8 +123,8 @@ def test_io(self): pl = self._create() - plistlib.writePlist(pl, test_support.TESTFN) - pl2 = plistlib.readPlist(test_support.TESTFN) + plistlib.writePlist(pl, support.TESTFN) + pl2 = plistlib.readPlist(support.TESTFN) self.assertEqual(dict(pl), dict(pl2)) def test_string(self): @@ -185,7 +185,7 @@ def test_main(): - test_support.run_unittest(TestPlistlib) + support.run_unittest(TestPlistlib) if __name__ == '__main__': Index: Lib/test/test_future_builtins.py =================================================================== --- Lib/test/test_future_builtins.py (revision 62290) +++ Lib/test/test_future_builtins.py (working copy) @@ -1,8 +1,8 @@ -import test.test_support, unittest +import test.support, unittest # we're testing the behavior of these future builtins: from future_builtins import hex, oct, map, zip, filter -from test import test_support +from test import support class BuiltinTest(unittest.TestCase): def test_hex(self): @@ -33,7 +33,7 @@ def test_main(verbose=None): - test.test_support.run_unittest(BuiltinTest) + test.support.run_unittest(BuiltinTest) if __name__ == "__main__": test_main(verbose=True) Index: Lib/test/test_aepack.py =================================================================== --- Lib/test/test_aepack.py (revision 62290) +++ Lib/test/test_aepack.py (working copy) @@ -4,7 +4,7 @@ import aepack import aetypes import os -from test import test_support +from test import support class TestAepack(unittest.TestCase): OBJECTS = [ @@ -77,7 +77,7 @@ def test_main(): - test_support.run_unittest(TestAepack) + support.run_unittest(TestAepack) if __name__ == '__main__': Index: Lib/test/test_errno.py =================================================================== --- Lib/test/test_errno.py (revision 62290) +++ Lib/test/test_errno.py (working copy) @@ -4,7 +4,7 @@ """ import errno -from test import test_support +from test import support import unittest std_c_errors = frozenset(['EDOM', 'ERANGE']) @@ -33,7 +33,7 @@ def test_main(): - test_support.run_unittest(ErrnoAttributeTests, ErrorcodeTests) + support.run_unittest(ErrnoAttributeTests, ErrorcodeTests) if __name__ == '__main__': Index: Lib/test/test_compare.py =================================================================== --- Lib/test/test_compare.py (revision 62290) +++ Lib/test/test_compare.py (working copy) @@ -1,5 +1,5 @@ import unittest -from test import test_support +from test import support class Empty: def __repr__(self): @@ -52,7 +52,7 @@ 'a=%r, b=%r' % (a, b)) def test_main(): - test_support.run_unittest(ComparisonTest) + support.run_unittest(ComparisonTest) if __name__ == '__main__': test_main() Index: Lib/test/test_syntax.py =================================================================== --- Lib/test/test_syntax.py (revision 62290) +++ Lib/test/test_syntax.py (working copy) @@ -423,7 +423,7 @@ import unittest import warnings -from test import test_support +from test import support class SyntaxTestCase(unittest.TestCase): @@ -495,9 +495,9 @@ self._check_error("int(base=10, '2')", "non-keyword arg") def test_main(): - test_support.run_unittest(SyntaxTestCase) + support.run_unittest(SyntaxTestCase) from test import test_syntax - test_support.run_doctest(test_syntax, verbosity=True) + support.run_doctest(test_syntax, verbosity=True) if __name__ == "__main__": test_main() Index: Lib/test/test_tarfile.py =================================================================== --- Lib/test/test_tarfile.py (revision 62290) +++ Lib/test/test_tarfile.py (working copy) @@ -11,7 +11,7 @@ import unittest import tarfile -from test import test_support +from test import support # Check for our compression modules. try: @@ -28,7 +28,7 @@ return md5(data).hexdigest() def path(path): - return test_support.findfile(path) + return support.findfile(path) TEMPDIR = os.path.join(tempfile.gettempdir(), "test_tarfile_tmp") tarname = path("testtar.tar") @@ -1189,7 +1189,7 @@ ] try: - test_support.run_unittest(*tests) + support.run_unittest(*tests) finally: if os.path.exists(TEMPDIR): shutil.rmtree(TEMPDIR) Index: Lib/test/test_fractions.py =================================================================== --- Lib/test/test_fractions.py (revision 62290) +++ Lib/test/test_fractions.py (working copy) @@ -1,7 +1,7 @@ """Tests for Lib/fractions.py.""" from decimal import Decimal -from test.test_support import run_unittest +from test.support import run_unittest import math import operator import fractions Index: Lib/test/test_compile.py =================================================================== --- Lib/test/test_compile.py (revision 62290) +++ Lib/test/test_compile.py (working copy) @@ -1,7 +1,7 @@ import unittest import sys import _ast -from test import test_support +from test import support class TestSpecifics(unittest.TestCase): @@ -458,7 +458,7 @@ def test_main(): - test_support.run_unittest(TestSpecifics) + support.run_unittest(TestSpecifics) if __name__ == "__main__": test_main() Index: Lib/test/test_wait4.py =================================================================== --- Lib/test/test_wait4.py (revision 62290) +++ Lib/test/test_wait4.py (working copy) @@ -4,7 +4,7 @@ import os import time from test.fork_wait import ForkWait -from test.test_support import TestSkipped, run_unittest, reap_children +from test.support import TestSkipped, run_unittest, reap_children try: os.fork Index: Lib/test/test_nis.py =================================================================== --- Lib/test/test_nis.py (revision 62290) +++ Lib/test/test_nis.py (working copy) @@ -1,4 +1,4 @@ -from test import test_support +from test import support import unittest import nis @@ -8,7 +8,7 @@ maps = nis.maps() except nis.error, msg: # NIS is probably not active, so this test isn't useful - if test_support.verbose: + if support.verbose: print "Test Skipped:", msg # Can't raise TestSkipped as regrtest only recognizes the exception # import time. @@ -37,7 +37,7 @@ break def test_main(): - test_support.run_unittest(NisTests) + support.run_unittest(NisTests) if __name__ == '__main__': test_main() Index: Lib/test/test_parser.py =================================================================== --- Lib/test/test_parser.py (revision 62290) +++ Lib/test/test_parser.py (working copy) @@ -1,7 +1,7 @@ import parser import unittest import sys -from test import test_support +from test import support # # First, we test that we can generate trees from valid source fragments, @@ -499,7 +499,7 @@ self.assertRaises(MemoryError, parser.expr, e) def test_main(): - test_support.run_unittest( + support.run_unittest( RoundtripLegalSyntaxTestCase, IllegalSyntaxTestCase, CompileTestCase, Index: Lib/test/test_exception_variations.py =================================================================== --- Lib/test/test_exception_variations.py (revision 62290) +++ Lib/test/test_exception_variations.py (working copy) @@ -1,5 +1,5 @@ -from test.test_support import run_unittest +from test.support import run_unittest import unittest class ExceptionTestCase(unittest.TestCase): Index: Lib/test/list_tests.py =================================================================== --- Lib/test/list_tests.py (revision 62290) +++ Lib/test/list_tests.py (working copy) @@ -5,7 +5,7 @@ import sys import os -from test import test_support, seq_tests +from test import support, seq_tests class CommonTest(seq_tests.CommonTest): @@ -57,14 +57,14 @@ d.append(d) d.append(400) try: - fo = open(test_support.TESTFN, "wb") + fo = open(support.TESTFN, "wb") print >> fo, d, fo.close() - fo = open(test_support.TESTFN, "rb") + fo = open(support.TESTFN, "rb") self.assertEqual(fo.read(), repr(d)) finally: fo.close() - os.remove(test_support.TESTFN) + os.remove(support.TESTFN) def test_set_subscript(self): a = self.type2test(range(20)) Index: Lib/test/test_openpty.py =================================================================== --- Lib/test/test_openpty.py (revision 62290) +++ Lib/test/test_openpty.py (working copy) @@ -1,7 +1,7 @@ # Test to see if openpty works. (But don't worry if it isn't available.) import os, unittest -from test.test_support import run_unittest, TestSkipped +from test.support import run_unittest, TestSkipped if not hasattr(os, "openpty"): raise TestSkipped, "No openpty() available." Index: Lib/test/test_audioop.py =================================================================== --- Lib/test/test_audioop.py (revision 62290) +++ Lib/test/test_audioop.py (working copy) @@ -1,6 +1,6 @@ # Test audioop. import audioop -from test.test_support import verbose +from test.support import verbose def gendata1(): return '\0\1\2' Index: Lib/test/test_iterlen.py =================================================================== --- Lib/test/test_iterlen.py (revision 62290) +++ Lib/test/test_iterlen.py (working copy) @@ -42,7 +42,7 @@ """ import unittest -from test import test_support +from test import support from itertools import repeat from collections import deque from __builtin__ import len as _len @@ -210,7 +210,7 @@ TestList, TestListReversed, ] - test_support.run_unittest(*unittests) + support.run_unittest(*unittests) if __name__ == "__main__": test_main() Index: Lib/test/test_doctest.py =================================================================== --- Lib/test/test_doctest.py (revision 62290) +++ Lib/test/test_doctest.py (working copy) @@ -2,7 +2,7 @@ Test script for doctest. """ -from test import test_support +from test import support import doctest import warnings @@ -2413,10 +2413,10 @@ def test_main(): # Check the doctest cases in doctest itself: - test_support.run_doctest(doctest, verbosity=True) + support.run_doctest(doctest, verbosity=True) # Check the doctest cases defined here: from test import test_doctest - test_support.run_doctest(test_doctest, verbosity=True) + support.run_doctest(test_doctest, verbosity=True) import trace, sys def test_coverage(coverdir): Index: Lib/test/test_httplib.py =================================================================== --- Lib/test/test_httplib.py (revision 62290) +++ Lib/test/test_httplib.py (working copy) @@ -4,9 +4,9 @@ from unittest import TestCase -from test import test_support +from test import support -HOST = test_support.HOST +HOST = support.HOST class FakeSocket: def __init__(self, text, fileclass=StringIO.StringIO): @@ -203,7 +203,7 @@ def setUp(self): self.serv = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - TimeoutTest.PORT = test_support.bind_port(self.serv) + TimeoutTest.PORT = support.bind_port(self.serv) self.serv.listen(5) def tearDown(self): @@ -249,7 +249,7 @@ self.assertEqual(h.timeout, 30) def test_main(verbose=None): - test_support.run_unittest(HeaderTests, OfflineTest, BasicTest, TimeoutTest, + support.run_unittest(HeaderTests, OfflineTest, BasicTest, TimeoutTest, HTTPSTimeoutTest) if __name__ == '__main__': Index: Lib/test/test_rfc822.py =================================================================== --- Lib/test/test_rfc822.py (revision 62290) +++ Lib/test/test_rfc822.py (working copy) @@ -1,6 +1,6 @@ import rfc822 import unittest -from test import test_support +from test import support try: from cStringIO import StringIO @@ -249,7 +249,7 @@ def test_main(): - test_support.run_unittest(MessageTestCase) + support.run_unittest(MessageTestCase) if __name__ == "__main__": Index: Lib/test/test_thread.py =================================================================== --- Lib/test/test_thread.py (revision 62290) +++ Lib/test/test_thread.py (working copy) @@ -1,7 +1,7 @@ import os import unittest import random -from test import test_support +from test import support import thread import time @@ -14,7 +14,7 @@ def verbose_print(arg): """Helper function for printing out debugging output.""" - if test_support.verbose: + if support.verbose: with _print_mutex: print arg @@ -162,7 +162,7 @@ def test_main(): - test_support.run_unittest(ThreadRunningTests, BarrierTest) + support.run_unittest(ThreadRunningTests, BarrierTest) if __name__ == "__main__": test_main() Index: Lib/test/test_hashlib.py =================================================================== --- Lib/test/test_hashlib.py (revision 62290) +++ Lib/test/test_hashlib.py (working copy) @@ -8,7 +8,7 @@ import hashlib import unittest -from test import test_support +from test import support def hexstr(s): @@ -184,7 +184,7 @@ def test_main(): - test_support.run_unittest(HashLibTestCase) + support.run_unittest(HashLibTestCase) if __name__ == "__main__": Index: Lib/test/test_mimetypes.py =================================================================== --- Lib/test/test_mimetypes.py (revision 62290) +++ Lib/test/test_mimetypes.py (working copy) @@ -2,7 +2,7 @@ import StringIO import unittest -from test import test_support +from test import support # Tell it we don't know about external files: mimetypes.knownfiles = [] @@ -63,7 +63,7 @@ def test_main(): - test_support.run_unittest(MimeTypesTestCase) + support.run_unittest(MimeTypesTestCase) if __name__ == "__main__": Index: Lib/test/test_capi.py =================================================================== --- Lib/test/test_capi.py (revision 62290) +++ Lib/test/test_capi.py (working copy) @@ -2,7 +2,7 @@ # these are all functions _testcapi exports whose name begins with 'test_'. import sys -from test import test_support +from test import support import _testcapi def test_main(): @@ -10,16 +10,16 @@ for name in dir(_testcapi): if name.startswith('test_'): test = getattr(_testcapi, name) - if test_support.verbose: + if support.verbose: print "internal", name try: test() except _testcapi.error: - raise test_support.TestFailed, sys.exc_info()[1] + raise support.TestFailed, sys.exc_info()[1] # some extra thread-state tests driven via _testcapi def TestThreadState(): - if test_support.verbose: + if support.verbose: print "auto-thread-state" idents = [] @@ -32,7 +32,7 @@ time.sleep(1) # Check our main thread is in the list exactly 3 times. if idents.count(thread.get_ident()) != 3: - raise test_support.TestFailed, \ + raise support.TestFailed, \ "Couldn't find main thread correctly in the list" try: Index: Lib/test/outstanding_bugs.py =================================================================== --- Lib/test/outstanding_bugs.py (revision 62290) +++ Lib/test/outstanding_bugs.py (working copy) @@ -7,7 +7,7 @@ # import unittest -from test import test_support +from test import support # # No test cases for outstanding bugs at the moment. @@ -15,7 +15,7 @@ def test_main(): - #test_support.run_unittest() + #support.run_unittest() pass if __name__ == "__main__": Index: Lib/test/test_pep247.py =================================================================== --- Lib/test/test_pep247.py (revision 62290) +++ Lib/test/test_pep247.py (working copy) @@ -14,7 +14,7 @@ import sha import unittest -from test import test_support +from test import support class Pep247Test(unittest.TestCase): @@ -68,7 +68,7 @@ self.check_module(hmac, key='abc') def test_main(): - test_support.run_unittest(Pep247Test) + support.run_unittest(Pep247Test) if __name__ == '__main__': test_main() Index: Lib/test/test_tcl.py =================================================================== --- Lib/test/test_tcl.py (revision 62290) +++ Lib/test/test_tcl.py (working copy) @@ -2,7 +2,7 @@ import unittest import os -from test import test_support +from test import support from Tkinter import Tcl from _tkinter import TclError @@ -151,7 +151,7 @@ os.environ['DISPLAY'] = old_display def test_main(): - test_support.run_unittest(TclTest) + support.run_unittest(TclTest) if __name__ == "__main__": test_main() Index: Lib/test/test_xml_etree.py =================================================================== --- Lib/test/test_xml_etree.py (revision 62290) +++ Lib/test/test_xml_etree.py (working copy) @@ -5,7 +5,7 @@ import doctest import sys -from test import test_support +from test import support SAMPLE_XML = """ @@ -349,7 +349,7 @@ def test_main(): from test import test_xml_etree - test_support.run_doctest(test_xml_etree, verbosity=True) + support.run_doctest(test_xml_etree, verbosity=True) if __name__ == '__main__': test_main() Index: Lib/test/test_sort.py =================================================================== --- Lib/test/test_sort.py (revision 62290) +++ Lib/test/test_sort.py (working copy) @@ -1,9 +1,9 @@ -from test import test_support +from test import support import random import sys import unittest -verbose = test_support.verbose +verbose = support.verbose nerrors = 0 def check(tag, expected, raw, compare=None): @@ -273,14 +273,14 @@ TestBugs, ) - test_support.run_unittest(*test_classes) + support.run_unittest(*test_classes) # verify reference counting if verbose and hasattr(sys, "gettotalrefcount"): import gc counts = [None] * 5 for i in xrange(len(counts)): - test_support.run_unittest(*test_classes) + support.run_unittest(*test_classes) gc.collect() counts[i] = sys.gettotalrefcount() print counts Index: Lib/test/test_defaultdict.py =================================================================== --- Lib/test/test_defaultdict.py (revision 62290) +++ Lib/test/test_defaultdict.py (working copy) @@ -4,7 +4,7 @@ import copy import tempfile import unittest -from test import test_support +from test import support from collections import defaultdict @@ -166,7 +166,7 @@ def test_main(): - test_support.run_unittest(TestDefaultDict) + support.run_unittest(TestDefaultDict) if __name__ == "__main__": test_main() Index: Lib/test/test_codecencodings_hk.py =================================================================== --- Lib/test/test_codecencodings_hk.py (revision 62290) +++ Lib/test/test_codecencodings_hk.py (working copy) @@ -4,7 +4,7 @@ # Codec encoding tests for HongKong encodings. # -from test import test_support +from test import support from test import test_multibytecodec_support import unittest @@ -21,7 +21,7 @@ ) def test_main(): - test_support.run_unittest(__name__) + support.run_unittest(__name__) if __name__ == "__main__": test_main() Index: Lib/test/test_operator.py =================================================================== --- Lib/test/test_operator.py (revision 62290) +++ Lib/test/test_operator.py (working copy) @@ -1,7 +1,7 @@ import operator import unittest -from test import test_support +from test import support class Seq1: def __init__(self, lst): @@ -143,7 +143,7 @@ self.failUnlessRaises(TypeError, operator.delslice, a, None, None) self.failUnless(operator.delslice(a, 2, 8) is None) self.assert_(a == [0, 1, 8, 9]) - operator.delslice(a, 0, test_support.MAX_Py_ssize_t) + operator.delslice(a, 0, support.MAX_Py_ssize_t) self.assert_(a == []) def test_div(self): @@ -172,7 +172,7 @@ self.failUnlessRaises(TypeError, operator.getslice) self.failUnlessRaises(TypeError, operator.getslice, a, None, None) self.failUnless(operator.getslice(a, 4, 6) == [4, 5]) - b = operator.getslice(a, 0, test_support.MAX_Py_ssize_t) + b = operator.getslice(a, 0, support.MAX_Py_ssize_t) self.assert_(b == a) def test_indexOf(self): @@ -322,7 +322,7 @@ self.failUnlessRaises(TypeError, operator.setslice, a, None, None, None) self.failUnless(operator.setslice(a, 1, 3, [2, 1]) is None) self.assert_(a == [0, 2, 1, 3]) - operator.setslice(a, 0, test_support.MAX_Py_ssize_t, []) + operator.setslice(a, 0, support.MAX_Py_ssize_t, []) self.assert_(a == []) def test_sub(self): @@ -512,14 +512,14 @@ OperatorTestCase, ) - test_support.run_unittest(*test_classes) + support.run_unittest(*test_classes) # verify reference counting if verbose and hasattr(sys, "gettotalrefcount"): import gc counts = [None] * 5 for i in xrange(len(counts)): - test_support.run_unittest(*test_classes) + support.run_unittest(*test_classes) gc.collect() counts[i] = sys.gettotalrefcount() print counts Index: Lib/test/test_cmath.py =================================================================== --- Lib/test/test_cmath.py (revision 62290) +++ Lib/test/test_cmath.py (working copy) @@ -1,4 +1,4 @@ -from test.test_support import run_unittest +from test.support import run_unittest import unittest import cmath, math Index: Lib/test/test_abstract_numbers.py =================================================================== --- Lib/test/test_abstract_numbers.py (revision 62290) +++ Lib/test/test_abstract_numbers.py (working copy) @@ -5,7 +5,7 @@ import unittest from numbers import Complex, Real, Rational, Integral from numbers import Number -from test import test_support +from test import support class TestNumbers(unittest.TestCase): def test_int(self): @@ -47,7 +47,7 @@ self.assertRaises(TypeError, int, c1) def test_main(): - test_support.run_unittest(TestNumbers) + support.run_unittest(TestNumbers) if __name__ == "__main__": Index: Lib/test/test_unary.py =================================================================== --- Lib/test/test_unary.py (revision 62290) +++ Lib/test/test_unary.py (working copy) @@ -1,7 +1,7 @@ """Test compiler changes for unary ops (+, -, ~) introduced in Python 2.2""" import unittest -from test.test_support import run_unittest, have_unicode +from test.support import run_unittest, have_unicode class UnaryOpTestCase(unittest.TestCase): Index: Lib/test/pickletester.py =================================================================== --- Lib/test/pickletester.py (revision 62290) +++ Lib/test/pickletester.py (working copy) @@ -4,7 +4,7 @@ import pickletools import copy_reg -from test.test_support import TestFailed, have_unicode, TESTFN, \ +from test.support import TestFailed, have_unicode, TESTFN, \ run_with_locale # Tests that try a number of pickle protocols should have a Index: Lib/test/test_zlib.py =================================================================== --- Lib/test/test_zlib.py (revision 62290) +++ Lib/test/test_zlib.py (working copy) @@ -1,5 +1,5 @@ import unittest -from test import test_support +from test import support import zlib import binascii import random @@ -469,7 +469,7 @@ def test_main(): - test_support.run_unittest( + support.run_unittest( ChecksumTestCase, ExceptionTestCase, CompressTestCase, Index: Lib/test/test_types.py =================================================================== --- Lib/test/test_types.py (revision 62290) +++ Lib/test/test_types.py (working copy) @@ -1,6 +1,6 @@ # Python test set -- part 6, built-in types -from test.test_support import run_unittest, have_unicode +from test.support import run_unittest, have_unicode import unittest import sys Index: Lib/test/test_re.py =================================================================== --- Lib/test/test_re.py (revision 62290) +++ Lib/test/test_re.py (working copy) @@ -1,7 +1,7 @@ import sys sys.path = ['.'] + sys.path -from test.test_support import verbose, run_unittest, catch_warning +from test.support import verbose, run_unittest, catch_warning import re from re import Scanner import sys, os, traceback Index: Lib/test/test_bigaddrspace.py =================================================================== --- Lib/test/test_bigaddrspace.py (revision 62290) +++ Lib/test/test_bigaddrspace.py (working copy) @@ -1,5 +1,5 @@ -from test import test_support -from test.test_support import bigaddrspacetest, MAX_Py_ssize_t +from test import support +from test.support import bigaddrspacetest, MAX_Py_ssize_t import unittest import operator @@ -38,9 +38,9 @@ def test_main(): - test_support.run_unittest(StrTest) + support.run_unittest(StrTest) if __name__ == '__main__': if len(sys.argv) > 1: - test_support.set_memlimit(sys.argv[1]) + support.set_memlimit(sys.argv[1]) test_main() Index: Lib/test/test_codeop.py =================================================================== --- Lib/test/test_codeop.py (revision 62290) +++ Lib/test/test_codeop.py (working copy) @@ -3,7 +3,7 @@ Nick Mathewson """ import unittest -from test.test_support import run_unittest, is_jython +from test.support import run_unittest, is_jython from codeop import compile_command, PyCF_DONT_IMPLY_DEDENT Index: Lib/test/test_compiler.py =================================================================== --- Lib/test/test_compiler.py (revision 62290) +++ Lib/test/test_compiler.py (working copy) @@ -1,7 +1,7 @@ import compiler from compiler.ast import flatten import os, sys, time, unittest -import test.test_support +import test.support from random import random from StringIO import StringIO @@ -24,7 +24,7 @@ next_time = time.time() + _PRINT_WORKING_MSG_INTERVAL libdir = os.path.dirname(unittest.__file__) - testdir = os.path.dirname(test.test_support.__file__) + testdir = os.path.dirname(test.support.__file__) for dir in [libdir, testdir]: for basename in os.listdir(dir): @@ -40,7 +40,7 @@ if not TEST_ALL and random() < 0.98: continue path = os.path.join(dir, basename) - if test.test_support.verbose: + if test.support.verbose: print "compiling", path f = open(path, "U") buf = f.read() @@ -238,8 +238,8 @@ def test_main(): global TEST_ALL - TEST_ALL = test.test_support.is_resource_enabled("compiler") - test.test_support.run_unittest(CompilerTest) + TEST_ALL = test.support.is_resource_enabled("compiler") + test.support.run_unittest(CompilerTest) if __name__ == "__main__": test_main() Index: Lib/test/test_asynchat.py =================================================================== --- Lib/test/test_asynchat.py (revision 62290) +++ Lib/test/test_asynchat.py (working copy) @@ -4,9 +4,9 @@ import asyncore, asynchat, socket, threading, time import unittest import sys -from test import test_support +from test import support -HOST = test_support.HOST +HOST = support.HOST SERVER_QUIT = 'QUIT\n' class echo_server(threading.Thread): @@ -18,7 +18,7 @@ threading.Thread.__init__(self) self.event = event self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - self.port = test_support.bind_port(self.sock) + self.port = support.bind_port(self.sock) def run(self): self.sock.listen(1) @@ -248,7 +248,7 @@ def test_main(verbose=None): - test_support.run_unittest(TestAsynchat, TestAsynchat_WithPoll, + support.run_unittest(TestAsynchat, TestAsynchat_WithPoll, TestHelperFunctions, TestFifo) if __name__ == "__main__": Index: Lib/test/test_pprint.py =================================================================== --- Lib/test/test_pprint.py (revision 62290) +++ Lib/test/test_pprint.py (working copy) @@ -1,5 +1,5 @@ import pprint -import test.test_support +import test.support import unittest import test.test_set @@ -402,7 +402,7 @@ def test_main(): - test.test_support.run_unittest(QueryTestCase) + test.support.run_unittest(QueryTestCase) if __name__ == "__main__": Index: Lib/test/test_codeccallbacks.py =================================================================== --- Lib/test/test_codeccallbacks.py (revision 62290) +++ Lib/test/test_codeccallbacks.py (working copy) @@ -1,4 +1,4 @@ -import test.test_support, unittest +import test.support, unittest import sys, codecs, htmlentitydefs, unicodedata class PosReturn: @@ -796,7 +796,7 @@ text.translate(charmap) def test_main(): - test.test_support.run_unittest(CodecCallbackTest) + test.support.run_unittest(CodecCallbackTest) if __name__ == "__main__": test_main() Index: Lib/test/test_getargs2.py =================================================================== --- Lib/test/test_getargs2.py (revision 62290) +++ Lib/test/test_getargs2.py (working copy) @@ -1,5 +1,5 @@ import unittest -from test import test_support +from test import support from _testcapi import getargs_keywords import warnings @@ -306,7 +306,7 @@ pass # PY_LONG_LONG not available else: tests.append(LongLong_TestCase) - test_support.run_unittest(*tests) + support.run_unittest(*tests) if __name__ == "__main__": test_main() Index: Lib/test/test_socketserver.py =================================================================== --- Lib/test/test_socketserver.py (revision 62290) +++ Lib/test/test_socketserver.py (working copy) @@ -15,14 +15,14 @@ import unittest import SocketServer -import test.test_support -from test.test_support import reap_children, verbose, TestSkipped -from test.test_support import TESTFN as TEST_FILE +import test.support +from test.support import reap_children, verbose, TestSkipped +from test.support import TESTFN as TEST_FILE -test.test_support.requires("network") +test.support.requires("network") TEST_STR = "hello world\n" -HOST = test.test_support.HOST +HOST = test.support.HOST HAVE_UNIX_SOCKETS = hasattr(socket, "AF_UNIX") HAVE_FORKING = hasattr(os, "fork") and os.name != "os2" @@ -249,7 +249,7 @@ # If the import lock is held, the threads will hang raise TestSkipped("can't run when import lock is held") - test.test_support.run_unittest(SocketServerTest) + test.support.run_unittest(SocketServerTest) if __name__ == "__main__": test_main() Index: Lib/test/test_SimpleHTTPServer.py =================================================================== --- Lib/test/test_SimpleHTTPServer.py (revision 62290) +++ Lib/test/test_SimpleHTTPServer.py (working copy) @@ -5,7 +5,7 @@ import os, unittest from SimpleHTTPServer import SimpleHTTPRequestHandler -from test import test_support +from test import support class SocketlessRequestHandler (SimpleHTTPRequestHandler): @@ -35,7 +35,7 @@ def test_main(): - test_support.run_unittest(SimpleHTTPRequestHandlerTestCase) + support.run_unittest(SimpleHTTPRequestHandlerTestCase) if __name__ == "__main__": test_main() Index: Lib/test/test_peepholer.py =================================================================== --- Lib/test/test_peepholer.py (revision 62290) +++ Lib/test/test_peepholer.py (working copy) @@ -205,16 +205,16 @@ def test_main(verbose=None): import sys - from test import test_support + from test import support test_classes = (TestTranforms,) - test_support.run_unittest(*test_classes) + support.run_unittest(*test_classes) # verify reference counting if verbose and hasattr(sys, "gettotalrefcount"): import gc counts = [None] * 5 for i in xrange(len(counts)): - test_support.run_unittest(*test_classes) + support.run_unittest(*test_classes) gc.collect() counts[i] = sys.gettotalrefcount() print counts Index: Lib/test/test_xdrlib.py =================================================================== --- Lib/test/test_xdrlib.py (revision 62290) +++ Lib/test/test_xdrlib.py (working copy) @@ -1,4 +1,4 @@ -from test import test_support +from test import support import unittest import xdrlib @@ -50,7 +50,7 @@ self.assertRaises(EOFError, up.unpack_uint) def test_main(): - test_support.run_unittest(XDRTest) + support.run_unittest(XDRTest) if __name__ == "__main__": test_main() Index: Lib/test/xmltests.py =================================================================== --- Lib/test/xmltests.py (revision 62290) +++ Lib/test/xmltests.py (working copy) @@ -2,9 +2,9 @@ # standard library. import sys -import test.test_support +import test.support -test.test_support.verbose = 0 +test.support.verbose = 0 def runtest(name): __import__(name) Index: Lib/test/test_abc.py =================================================================== --- Lib/test/test_abc.py (revision 62290) +++ Lib/test/test_abc.py (working copy) @@ -4,7 +4,7 @@ """Unit tests for abc.py.""" import unittest -from test import test_support +from test import support import abc from inspect import isabstract @@ -181,7 +181,7 @@ def test_main(): - test_support.run_unittest(TestABC) + support.run_unittest(TestABC) if __name__ == "__main__": Index: Lib/test/test_ossaudiodev.py =================================================================== --- Lib/test/test_ossaudiodev.py (revision 62290) +++ Lib/test/test_ossaudiodev.py (working copy) @@ -1,7 +1,7 @@ -from test import test_support -test_support.requires('audio') +from test import support +support.requires('audio') -from test.test_support import findfile, TestSkipped +from test.support import findfile, TestSkipped import errno import ossaudiodev @@ -164,7 +164,7 @@ raise TestSkipped(msg) raise dsp.close() - test_support.run_unittest(__name__) + support.run_unittest(__name__) if __name__ == "__main__": test_main() Index: Lib/test/test_cd.py =================================================================== --- Lib/test/test_cd.py (revision 62290) +++ Lib/test/test_cd.py (working copy) @@ -3,7 +3,7 @@ Roger E. Masse """ import cd -from test.test_support import verbose +from test.support import verbose cdattrs = ['BLOCKSIZE', 'CDROM', 'DATASIZE', 'ERROR', 'NODISC', 'PAUSED', 'PLAYING', 'READY', 'STILL', '__doc__', '__name__', 'atime', 'audio', 'catalog', 'control', 'createparser', 'error', Index: Lib/test/test_long_future.py =================================================================== --- Lib/test/test_long_future.py (revision 62290) +++ Lib/test/test_long_future.py (working copy) @@ -4,7 +4,7 @@ # trick just part of test_long into using future division. import unittest -from test.test_support import run_unittest +from test.support import run_unittest class TrueDivisionTests(unittest.TestCase): def test(self): Index: Lib/test/test_sgmllib.py =================================================================== --- Lib/test/test_sgmllib.py (revision 62290) +++ Lib/test/test_sgmllib.py (working copy) @@ -2,7 +2,7 @@ import re import sgmllib import unittest -from test import test_support +from test import support class EventCollector(sgmllib.SGMLParser): @@ -365,7 +365,7 @@ # Just verify this code doesn't cause a hang. CHUNK = 1024 # increasing this to 8212 makes the problem go away - f = open(test_support.findfile('sgml_input.html')) + f = open(support.findfile('sgml_input.html')) fp = sgmllib.SGMLParser() while 1: data = f.read(CHUNK) @@ -431,7 +431,7 @@ def test_main(): - test_support.run_unittest(SGMLParserTestCase) + support.run_unittest(SGMLParserTestCase) if __name__ == "__main__": Index: Lib/test/test_mmap.py =================================================================== --- Lib/test/test_mmap.py (revision 62290) +++ Lib/test/test_mmap.py (working copy) @@ -1,4 +1,4 @@ -from test.test_support import TESTFN, run_unittest +from test.support import TESTFN, run_unittest import mmap import unittest import os, re Index: Lib/test/test_pyexpat.py =================================================================== --- Lib/test/test_pyexpat.py (revision 62290) +++ Lib/test/test_pyexpat.py (working copy) @@ -7,7 +7,7 @@ import pyexpat from xml.parsers import expat -from test.test_support import sortdict, run_unittest +from test.support import sortdict, run_unittest class SetAttributeTest(unittest.TestCase): Index: Lib/test/test_mhlib.py =================================================================== --- Lib/test/test_mhlib.py (revision 62290) +++ Lib/test/test_mhlib.py (working copy) @@ -7,7 +7,7 @@ ### mhlib. It should. import unittest -from test.test_support import run_unittest, TESTFN, TestSkipped +from test.support import run_unittest, TESTFN, TestSkipped import os, StringIO import sys import mhlib Index: Lib/test/test_winreg.py =================================================================== --- Lib/test/test_winreg.py (revision 62290) +++ Lib/test/test_winreg.py (working copy) @@ -5,7 +5,7 @@ import os, sys import unittest -from test import test_support +from test import support test_key_name = "SOFTWARE\\Python Registry Test Key - Delete Me" @@ -19,7 +19,7 @@ ("Big Binary", "x"*(2**14), REG_BINARY), ] -if test_support.have_unicode: +if support.have_unicode: test_data += [ (unicode("Unicode Val"), unicode("A Unicode value"), REG_SZ,), ("UnicodeExpand", unicode("The path is %path%"), REG_EXPAND_SZ), @@ -167,7 +167,7 @@ self.assertEqual(r, os.environ["windir"] + "\\test") def test_main(): - test_support.run_unittest(WinregTests) + support.run_unittest(WinregTests) if __name__ == "__main__": try: Index: Lib/test/test_al.py =================================================================== --- Lib/test/test_al.py (revision 62290) +++ Lib/test/test_al.py (working copy) @@ -3,7 +3,7 @@ Roger E. Masse """ import al -from test.test_support import verbose +from test.support import verbose alattrs = ['__doc__', '__name__', 'getdefault', 'getminmax', 'getname', 'getparams', 'newconfig', 'openport', 'queryparams', 'setparams'] Index: Lib/test/test_minidom.py =================================================================== --- Lib/test/test_minidom.py (revision 62290) +++ Lib/test/test_minidom.py (working copy) @@ -4,7 +4,7 @@ import sys import pickle from StringIO import StringIO -from test.test_support import verbose, run_unittest, TestSkipped +from test.support import verbose, run_unittest, TestSkipped import unittest import xml.dom Index: Lib/test/test_stringprep.py =================================================================== --- Lib/test/test_stringprep.py (revision 62290) +++ Lib/test/test_stringprep.py (working copy) @@ -2,7 +2,7 @@ # Since we don't have them, this test checks only a few codepoints. import unittest -from test import test_support +from test import support from stringprep import * @@ -90,7 +90,7 @@ # print p, h.hexdigest() def test_main(): - test_support.run_unittest(StringprepTests) + support.run_unittest(StringprepTests) if __name__ == '__main__': test_main() Index: Lib/test/test_structseq.py =================================================================== --- Lib/test/test_structseq.py (revision 62290) +++ Lib/test/test_structseq.py (working copy) @@ -1,5 +1,5 @@ import unittest -from test import test_support +from test import support import time @@ -114,7 +114,7 @@ L[start:stop:step]) def test_main(): - test_support.run_unittest(StructSeqTest) + support.run_unittest(StructSeqTest) if __name__ == "__main__": test_main() Index: Lib/test/test_locale.py =================================================================== --- Lib/test/test_locale.py (revision 62290) +++ Lib/test/test_locale.py (working copy) @@ -1,4 +1,4 @@ -from test.test_support import verbose, TestSkipped +from test.support import verbose, TestSkipped import locale import sys Index: Lib/test/test_cgi.py =================================================================== --- Lib/test/test_cgi.py (revision 62290) +++ Lib/test/test_cgi.py (working copy) @@ -1,4 +1,4 @@ -from test.test_support import run_unittest +from test.support import run_unittest import cgi import os import sys Index: Lib/test/test_codecencodings_kr.py =================================================================== --- Lib/test/test_codecencodings_kr.py (revision 62290) +++ Lib/test/test_codecencodings_kr.py (working copy) @@ -4,7 +4,7 @@ # Codec encoding tests for ROK encodings. # -from test import test_support +from test import support from test import test_multibytecodec_support import unittest @@ -63,7 +63,7 @@ ) def test_main(): - test_support.run_unittest(__name__) + support.run_unittest(__name__) if __name__ == "__main__": test_main() Index: Lib/test/test_popen2.py =================================================================== --- Lib/test/test_popen2.py (revision 62290) +++ Lib/test/test_popen2.py (working copy) @@ -12,7 +12,7 @@ import unittest import popen2 -from test.test_support import TestSkipped, run_unittest, reap_children +from test.support import TestSkipped, run_unittest, reap_children if sys.platform[:4] == 'beos' or sys.platform[:6] == 'atheos': # Locks get messed up or something. Generally we're supposed Index: Lib/test/test_profilehooks.py =================================================================== --- Lib/test/test_profilehooks.py (revision 62290) +++ Lib/test/test_profilehooks.py (working copy) @@ -2,7 +2,7 @@ import sys import unittest -from test import test_support +from test import support class TestGetProfile(unittest.TestCase): def setUp(self): @@ -357,7 +357,7 @@ except TypeError: pass else: - raise test_support.TestFailed( + raise support.TestFailed( 'sys.setprofile() did not raise TypeError') if p is None: @@ -374,7 +374,7 @@ def test_main(): - test_support.run_unittest( + support.run_unittest( TestGetProfile, ProfileHookTestCase, ProfileSimulatorTestCase Index: Lib/test/test_codecmaps_tw.py =================================================================== --- Lib/test/test_codecmaps_tw.py (revision 62290) +++ Lib/test/test_codecmaps_tw.py (working copy) @@ -4,7 +4,7 @@ # Codec mapping tests for ROC encodings # -from test import test_support +from test import support from test import test_multibytecodec_support import unittest @@ -25,7 +25,7 @@ ] def test_main(): - test_support.run_unittest(__name__) + support.run_unittest(__name__) if __name__ == "__main__": test_main() Index: Lib/test/test_str.py =================================================================== --- Lib/test/test_str.py (revision 62290) +++ Lib/test/test_str.py (working copy) @@ -1,7 +1,7 @@ import struct import sys -from test import test_support, string_tests +from test import support, string_tests class StrTest( @@ -352,7 +352,7 @@ def test_main(): - test_support.run_unittest(StrTest) + support.run_unittest(StrTest) if __name__ == "__main__": test_main() Index: Lib/test/test_buffer.py =================================================================== --- Lib/test/test_buffer.py (revision 62290) +++ Lib/test/test_buffer.py (working copy) @@ -5,7 +5,7 @@ """ import unittest -from test import test_support +from test import support class BufferTests(unittest.TestCase): @@ -23,7 +23,7 @@ def test_main(): - test_support.run_unittest(BufferTests) + support.run_unittest(BufferTests) if __name__ == "__main__": test_main() Index: Lib/test/test_scope.py =================================================================== --- Lib/test/test_scope.py (revision 62290) +++ Lib/test/test_scope.py (working copy) @@ -1,5 +1,5 @@ import unittest -from test.test_support import check_syntax_error, run_unittest +from test.support import check_syntax_error, run_unittest import warnings warnings.filterwarnings("ignore", r"import \*", SyntaxWarning, "") Index: Lib/test/test_cfgparser.py =================================================================== --- Lib/test/test_cfgparser.py (revision 62290) +++ Lib/test/test_cfgparser.py (working copy) @@ -3,7 +3,7 @@ import unittest import UserDict -from test import test_support +from test import support class SortedDict(UserDict.UserDict): def items(self): @@ -261,7 +261,7 @@ cf.set("sect", "option2", unicode("splat")) def test_read_returns_file_list(self): - file1 = test_support.findfile("cfgparser.1") + file1 = support.findfile("cfgparser.1") # check when we pass a mix of readable and non-readable files: cf = self.newconfig() parsed_files = cf.read([file1, "nonexistant-file"]) @@ -479,7 +479,7 @@ "o4 = 1\n\n") def test_main(): - test_support.run_unittest( + support.run_unittest( ConfigParserTestCase, RawConfigParserTestCase, SafeConfigParserTestCase, Index: Lib/test/test_signal.py =================================================================== --- Lib/test/test_signal.py (revision 62290) +++ Lib/test/test_signal.py (working copy) @@ -1,5 +1,5 @@ import unittest -from test import test_support +from test import support from contextlib import closing, nested import gc import pickle @@ -10,7 +10,7 @@ import sys, os, time, errno if sys.platform[:3] in ('win', 'os2') or sys.platform == 'riscos': - raise test_support.TestSkipped("Can't test signal on %s" % \ + raise support.TestSkipped("Can't test signal on %s" % \ sys.platform) @@ -53,13 +53,13 @@ def handlerA(self, signum, frame): self.a_called = True - if test_support.verbose: + if support.verbose: print "handlerA invoked from signal %s at:\n%s" % ( signum, self.format_frame(frame, limit=1)) def handlerB(self, signum, frame): self.b_called = True - if test_support.verbose: + if support.verbose: print "handlerB invoked from signal %s at:\n%s" % ( signum, self.format_frame(frame, limit=1)) raise HandlerBCalled(signum, self.format_frame(frame)) @@ -88,7 +88,7 @@ # Let the sub-processes know who to send signals to. pid = os.getpid() - if test_support.verbose: + if support.verbose: print "test runner's pid is", pid child = ignoring_eintr(subprocess.Popen, ['kill', '-HUP', str(pid)]) @@ -113,7 +113,7 @@ except HandlerBCalled: self.assertTrue(self.b_called) self.assertFalse(self.a_called) - if test_support.verbose: + if support.verbose: print "HandlerBCalled exception caught" child = ignoring_eintr(subprocess.Popen, ['kill', '-USR2', str(pid)]) @@ -130,7 +130,7 @@ # may return early. time.sleep(1) except KeyboardInterrupt: - if test_support.verbose: + if support.verbose: print "KeyboardInterrupt (the alarm() went off)" except: self.fail("Some other exception woke us from pause: %s" % @@ -309,7 +309,7 @@ def sig_alrm(self, *args): self.hndl_called = True - if test_support.verbose: + if support.verbose: print("SIGALRM handler invoked", args) def sig_vtalrm(self, *args): @@ -322,19 +322,19 @@ elif self.hndl_count == 3: # disable ITIMER_VIRTUAL, this function shouldn't be called anymore signal.setitimer(signal.ITIMER_VIRTUAL, 0) - if test_support.verbose: + if support.verbose: print("last SIGVTALRM handler call") self.hndl_count += 1 - if test_support.verbose: + if support.verbose: print("SIGVTALRM handler invoked", args) def sig_prof(self, *args): self.hndl_called = True signal.setitimer(signal.ITIMER_PROF, 0) - if test_support.verbose: + if support.verbose: print("SIGPROF handler invoked", args) def test_itimer_exc(self): @@ -349,7 +349,7 @@ def test_itimer_real(self): self.itimer = signal.ITIMER_REAL signal.setitimer(self.itimer, 1.0) - if test_support.verbose: + if support.verbose: print("\ncall pause()...") signal.pause() @@ -384,7 +384,7 @@ self.assertEqual(self.hndl_called, True) def test_main(): - test_support.run_unittest(BasicSignalTests, InterProcessSignalTests, + support.run_unittest(BasicSignalTests, InterProcessSignalTests, WakeupSignalTests, SiginterruptTest, ItimerTest) Index: Lib/test/test_codecmaps_cn.py =================================================================== --- Lib/test/test_codecmaps_cn.py (revision 62290) +++ Lib/test/test_codecmaps_cn.py (working copy) @@ -4,7 +4,7 @@ # Codec mapping tests for PRC encodings # -from test import test_support +from test import support from test import test_multibytecodec_support import unittest @@ -27,7 +27,7 @@ def test_main(): - test_support.run_unittest(__name__) + support.run_unittest(__name__) if __name__ == "__main__": test_main() Index: Lib/test/test_textwrap.py =================================================================== --- Lib/test/test_textwrap.py (revision 62290) +++ Lib/test/test_textwrap.py (working copy) @@ -9,7 +9,7 @@ # import unittest -from test import test_support +from test import support from textwrap import TextWrapper, wrap, fill, dedent @@ -336,7 +336,7 @@ "with ", "much white", "space."], drop_whitespace=False) - if test_support.have_unicode: + if support.have_unicode: def test_unicode(self): # *Very* simple test of wrapping Unicode strings. I'm sure # there's more to it than this, but let's at least make @@ -580,7 +580,7 @@ def test_main(): - test_support.run_unittest(WrapTestCase, + support.run_unittest(WrapTestCase, LongWordTestCase, IndentTestCases, DedentTestCase) Index: Lib/test/test_unicodedata.py =================================================================== --- Lib/test/test_unicodedata.py (revision 62290) +++ Lib/test/test_unicodedata.py (working copy) @@ -5,7 +5,7 @@ (c) Copyright CNRI, All Rights Reserved. NO WARRANTY. """#" -import unittest, test.test_support +import unittest, test.support import hashlib encoding = 'utf-8' @@ -218,7 +218,7 @@ self.assertEquals(self.db.lookup("GOTHIC LETTER FAIHU"), u'\U00010346') def test_main(): - test.test_support.run_unittest( + test.support.run_unittest( UnicodeMiscTest, UnicodeMethodsTest, UnicodeFunctionsTest Index: Lib/test/test_queue.py =================================================================== --- Lib/test/test_queue.py (revision 62290) +++ Lib/test/test_queue.py (working copy) @@ -5,7 +5,7 @@ import threading import time import unittest -from test import test_support +from test import support QUEUE_SIZE = 5 @@ -313,7 +313,7 @@ def test_main(): - test_support.run_unittest(QueueTest, LifoQueueTest, PriorityQueueTest, + support.run_unittest(QueueTest, LifoQueueTest, PriorityQueueTest, FailingQueueTest) Index: Lib/test/test_poplib.py =================================================================== --- Lib/test/test_poplib.py (revision 62290) +++ Lib/test/test_poplib.py (working copy) @@ -4,9 +4,9 @@ import time from unittest import TestCase -from test import test_support +from test import support -HOST = test_support.HOST +HOST = support.HOST def server(evt, serv): serv.listen(5) @@ -27,7 +27,7 @@ self.evt = threading.Event() self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.sock.settimeout(3) - self.port = test_support.bind_port(self.sock) + self.port = support.bind_port(self.sock) threading.Thread(target=server, args=(self.evt,self.sock)).start() time.sleep(.1) @@ -65,7 +65,7 @@ def test_main(verbose=None): - test_support.run_unittest(GeneralTests) + support.run_unittest(GeneralTests) if __name__ == '__main__': test_main() Index: Lib/test/test_marshal.py =================================================================== --- Lib/test/test_marshal.py (revision 62290) +++ Lib/test/test_marshal.py (working copy) @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: iso-8859-1 -*- -from test import test_support +from test import support import marshal import sys import unittest @@ -16,11 +16,11 @@ s = marshal.dumps(expected) got = marshal.loads(s) self.assertEqual(expected, got) - marshal.dump(expected, file(test_support.TESTFN, "wb")) - got = marshal.load(file(test_support.TESTFN, "rb")) + marshal.dump(expected, file(support.TESTFN, "wb")) + got = marshal.load(file(support.TESTFN, "rb")) self.assertEqual(expected, got) n = n >> 1 - os.unlink(test_support.TESTFN) + os.unlink(support.TESTFN) def test_int64(self): # Simulate int marshaling on a 64-bit box. This is most interesting if @@ -51,8 +51,8 @@ new = marshal.loads(marshal.dumps(b)) self.assertEqual(b, new) self.assertEqual(type(b), type(new)) - marshal.dump(b, file(test_support.TESTFN, "wb")) - new = marshal.load(file(test_support.TESTFN, "rb")) + marshal.dump(b, file(support.TESTFN, "wb")) + new = marshal.load(file(support.TESTFN, "rb")) self.assertEqual(b, new) self.assertEqual(type(b), type(new)) @@ -67,8 +67,8 @@ s = marshal.dumps(f) got = marshal.loads(s) self.assertEqual(f, got) - marshal.dump(f, file(test_support.TESTFN, "wb")) - got = marshal.load(file(test_support.TESTFN, "rb")) + marshal.dump(f, file(support.TESTFN, "wb")) + got = marshal.load(file(support.TESTFN, "rb")) self.assertEqual(f, got) n /= 123.4567 @@ -94,15 +94,15 @@ got = marshal.loads(s) self.assertEqual(f, got) - marshal.dump(f, file(test_support.TESTFN, "wb")) - got = marshal.load(file(test_support.TESTFN, "rb")) + marshal.dump(f, file(support.TESTFN, "wb")) + got = marshal.load(file(support.TESTFN, "rb")) self.assertEqual(f, got) - marshal.dump(f, file(test_support.TESTFN, "wb"), 1) - got = marshal.load(file(test_support.TESTFN, "rb")) + marshal.dump(f, file(support.TESTFN, "wb"), 1) + got = marshal.load(file(support.TESTFN, "rb")) self.assertEqual(f, got) n *= 123.4567 - os.unlink(test_support.TESTFN) + os.unlink(support.TESTFN) class StringTestCase(unittest.TestCase): def test_unicode(self): @@ -110,32 +110,32 @@ new = marshal.loads(marshal.dumps(s)) self.assertEqual(s, new) self.assertEqual(type(s), type(new)) - marshal.dump(s, file(test_support.TESTFN, "wb")) - new = marshal.load(file(test_support.TESTFN, "rb")) + marshal.dump(s, file(support.TESTFN, "wb")) + new = marshal.load(file(support.TESTFN, "rb")) self.assertEqual(s, new) self.assertEqual(type(s), type(new)) - os.unlink(test_support.TESTFN) + os.unlink(support.TESTFN) def test_string(self): for s in ["", "Andrè Previn", "abc", " "*10000]: new = marshal.loads(marshal.dumps(s)) self.assertEqual(s, new) self.assertEqual(type(s), type(new)) - marshal.dump(s, file(test_support.TESTFN, "wb")) - new = marshal.load(file(test_support.TESTFN, "rb")) + marshal.dump(s, file(support.TESTFN, "wb")) + new = marshal.load(file(support.TESTFN, "rb")) self.assertEqual(s, new) self.assertEqual(type(s), type(new)) - os.unlink(test_support.TESTFN) + os.unlink(support.TESTFN) def test_buffer(self): for s in ["", "Andrè Previn", "abc", " "*10000]: b = buffer(s) new = marshal.loads(marshal.dumps(b)) self.assertEqual(s, new) - marshal.dump(b, file(test_support.TESTFN, "wb")) - new = marshal.load(file(test_support.TESTFN, "rb")) + marshal.dump(b, file(support.TESTFN, "wb")) + new = marshal.load(file(support.TESTFN, "rb")) self.assertEqual(s, new) - os.unlink(test_support.TESTFN) + os.unlink(support.TESTFN) class ExceptionTestCase(unittest.TestCase): def test_exceptions(self): @@ -161,28 +161,28 @@ def test_dict(self): new = marshal.loads(marshal.dumps(self.d)) self.assertEqual(self.d, new) - marshal.dump(self.d, file(test_support.TESTFN, "wb")) - new = marshal.load(file(test_support.TESTFN, "rb")) + marshal.dump(self.d, file(support.TESTFN, "wb")) + new = marshal.load(file(support.TESTFN, "rb")) self.assertEqual(self.d, new) - os.unlink(test_support.TESTFN) + os.unlink(support.TESTFN) def test_list(self): lst = self.d.items() new = marshal.loads(marshal.dumps(lst)) self.assertEqual(lst, new) - marshal.dump(lst, file(test_support.TESTFN, "wb")) - new = marshal.load(file(test_support.TESTFN, "rb")) + marshal.dump(lst, file(support.TESTFN, "wb")) + new = marshal.load(file(support.TESTFN, "rb")) self.assertEqual(lst, new) - os.unlink(test_support.TESTFN) + os.unlink(support.TESTFN) def test_tuple(self): t = tuple(self.d.keys()) new = marshal.loads(marshal.dumps(t)) self.assertEqual(t, new) - marshal.dump(t, file(test_support.TESTFN, "wb")) - new = marshal.load(file(test_support.TESTFN, "rb")) + marshal.dump(t, file(support.TESTFN, "wb")) + new = marshal.load(file(support.TESTFN, "rb")) self.assertEqual(t, new) - os.unlink(test_support.TESTFN) + os.unlink(support.TESTFN) def test_sets(self): for constructor in (set, frozenset): @@ -191,10 +191,10 @@ self.assertEqual(t, new) self.assert_(isinstance(new, constructor)) self.assertNotEqual(id(t), id(new)) - marshal.dump(t, file(test_support.TESTFN, "wb")) - new = marshal.load(file(test_support.TESTFN, "rb")) + marshal.dump(t, file(support.TESTFN, "wb")) + new = marshal.load(file(support.TESTFN, "rb")) self.assertEqual(t, new) - os.unlink(test_support.TESTFN) + os.unlink(support.TESTFN) class BugsTestCase(unittest.TestCase): def test_bug_5888452(self): @@ -256,7 +256,7 @@ self.assertRaises(ValueError, marshal.dumps, subtyp()) def test_main(): - test_support.run_unittest(IntTestCase, + support.run_unittest(IntTestCase, FloatTestCase, StringTestCase, CodeTestCase, Index: Lib/test/test_bz2.py =================================================================== --- Lib/test/test_bz2.py (revision 62290) +++ Lib/test/test_bz2.py (working copy) @@ -1,6 +1,6 @@ #!/usr/bin/python -from test import test_support -from test.test_support import TESTFN +from test import support +from test.support import TESTFN import unittest from cStringIO import StringIO @@ -359,13 +359,13 @@ self.assertRaises(ValueError, bz2.decompress, self.DATA[:-10]) def test_main(): - test_support.run_unittest( + support.run_unittest( BZ2FileTest, BZ2CompressorTest, BZ2DecompressorTest, FuncTest ) - test_support.reap_children() + support.reap_children() if __name__ == '__main__': test_main() Index: Lib/test/test_cookielib.py =================================================================== --- Lib/test/test_cookielib.py (revision 62290) +++ Lib/test/test_cookielib.py (working copy) @@ -4,7 +4,7 @@ import re, os, time from unittest import TestCase -from test import test_support +from test import support class DateTimeTests(TestCase): @@ -235,7 +235,7 @@ def test_lwp_valueless_cookie(self): # cookies with no value should be saved and loaded consistently from cookielib import LWPCookieJar - filename = test_support.TESTFN + filename = support.TESTFN c = LWPCookieJar() interact_netscape(c, "http://www.acme.com/", 'boo') self.assertEqual(c._cookies["www.acme.com"]["/"]["boo"].value, None) @@ -251,7 +251,7 @@ def test_bad_magic(self): from cookielib import LWPCookieJar, MozillaCookieJar, LoadError # IOErrors (eg. file doesn't exist) are allowed to propagate - filename = test_support.TESTFN + filename = support.TESTFN for cookiejar_class in LWPCookieJar, MozillaCookieJar: c = cookiejar_class() try: @@ -357,7 +357,7 @@ # missing = sign in Cookie: header is regarded by Mozilla as a missing # name, and by cookielib as a missing value - filename = test_support.TESTFN + filename = support.TESTFN c = MozillaCookieJar(filename) interact_netscape(c, "http://www.acme.com/", 'eggs') interact_netscape(c, "http://www.acme.com/", '"spam"; path=/foo/') @@ -1506,7 +1506,7 @@ self.assertEquals(len(c), 6) # save and restore - filename = test_support.TESTFN + filename = support.TESTFN try: c.save(filename, ignore_discard=True) @@ -1548,7 +1548,7 @@ year_plus_one = time.localtime()[0] + 1 - filename = test_support.TESTFN + filename = support.TESTFN c = MozillaCookieJar(filename, policy=DefaultCookiePolicy(rfc2965=True)) @@ -1724,7 +1724,7 @@ def test_main(verbose=None): from test import test_sets - test_support.run_unittest( + support.run_unittest( DateTimeTests, HeaderTests, CookieTests, Index: Lib/test/test_urllibnet.py =================================================================== --- Lib/test/test_urllibnet.py (revision 62290) +++ Lib/test/test_urllibnet.py (working copy) @@ -1,7 +1,7 @@ #!/usr/bin/env python import unittest -from test import test_support +from test import support import socket import urllib @@ -161,8 +161,8 @@ def test_specified_path(self): # Make sure that specifying the location of the file to write to works. file_location,info = self.urlretrieve("http://www.python.org/", - test_support.TESTFN) - self.assertEqual(file_location, test_support.TESTFN) + support.TESTFN) + self.assertEqual(file_location, support.TESTFN) self.assert_(os.path.exists(file_location)) FILE = file(file_location) try: @@ -181,8 +181,8 @@ def test_main(): - test_support.requires('network') - test_support.run_unittest(URLTimeoutTest, + support.requires('network') + support.run_unittest(URLTimeoutTest, urlopenNetworkTests, urlretrieveNetworkTests) Index: Lib/test/test_bsddb3.py =================================================================== --- Lib/test/test_bsddb3.py (revision 62290) +++ Lib/test/test_bsddb3.py (working copy) @@ -7,7 +7,7 @@ import tempfile import time import unittest -from test.test_support import requires, verbose, run_unittest, unlink, rmtree +from test.support import requires, verbose, run_unittest, unlink, rmtree # When running as a script instead of within the regrtest framework, skip the # requires test, since it's obvious we want to run them. Index: Lib/test/test_iter.py =================================================================== --- Lib/test/test_iter.py (revision 62290) +++ Lib/test/test_iter.py (working copy) @@ -1,7 +1,7 @@ # Test iterators. import unittest -from test.test_support import run_unittest, TESTFN, unlink, have_unicode +from test.support import run_unittest, TESTFN, unlink, have_unicode # Test result of triple loop (too big to inline) TRIPLETS = [(0, 0, 0), (0, 0, 1), (0, 0, 2), Index: Lib/test/test_deque.py =================================================================== --- Lib/test/test_deque.py (revision 62290) +++ Lib/test/test_deque.py (working copy) @@ -1,6 +1,6 @@ from collections import deque import unittest -from test import test_support, seq_tests +from test import support, seq_tests from weakref import proxy import copy import cPickle as pickle @@ -63,28 +63,28 @@ self.assertEqual(list(d), range(7, 10)) d = deque(xrange(200), maxlen=10) d.append(d) - test_support.unlink(test_support.TESTFN) - fo = open(test_support.TESTFN, "wb") + support.unlink(support.TESTFN) + fo = open(support.TESTFN, "wb") try: print >> fo, d, fo.close() - fo = open(test_support.TESTFN, "rb") + fo = open(support.TESTFN, "rb") self.assertEqual(fo.read(), repr(d)) finally: fo.close() - test_support.unlink(test_support.TESTFN) + support.unlink(support.TESTFN) d = deque(range(10), maxlen=None) self.assertEqual(repr(d), 'deque([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])') - fo = open(test_support.TESTFN, "wb") + fo = open(support.TESTFN, "wb") try: print >> fo, d, fo.close() - fo = open(test_support.TESTFN, "rb") + fo = open(support.TESTFN, "rb") self.assertEqual(fo.read(), repr(d)) finally: fo.close() - test_support.unlink(test_support.TESTFN) + support.unlink(support.TESTFN) def test_comparisons(self): d = deque('xabc'); d.popleft() @@ -282,16 +282,16 @@ def test_print(self): d = deque(xrange(200)) d.append(d) - test_support.unlink(test_support.TESTFN) - fo = open(test_support.TESTFN, "wb") + support.unlink(support.TESTFN) + fo = open(support.TESTFN, "wb") try: print >> fo, d, fo.close() - fo = open(test_support.TESTFN, "rb") + fo = open(support.TESTFN, "rb") self.assertEqual(fo.read(), repr(d)) finally: fo.close() - test_support.unlink(test_support.TESTFN) + support.unlink(support.TESTFN) def test_init(self): self.assertRaises(TypeError, deque, 'abc', 2, 3); @@ -668,21 +668,21 @@ TestSubclassWithKwargs, ) - test_support.run_unittest(*test_classes) + support.run_unittest(*test_classes) # verify reference counting if verbose and hasattr(sys, "gettotalrefcount"): import gc counts = [None] * 5 for i in xrange(len(counts)): - test_support.run_unittest(*test_classes) + support.run_unittest(*test_classes) gc.collect() counts[i] = sys.gettotalrefcount() print counts # doctests from test import test_deque - test_support.run_doctest(test_deque, verbose) + support.run_doctest(test_deque, verbose) if __name__ == "__main__": test_main(verbose=True) Index: Lib/test/test_strptime.py =================================================================== --- Lib/test/test_strptime.py (revision 62290) +++ Lib/test/test_strptime.py (working copy) @@ -5,7 +5,7 @@ import locale import re import sys -from test import test_support +from test import support from datetime import date as datetime_date import _strptime @@ -551,7 +551,7 @@ def test_main(): - test_support.run_unittest( + support.run_unittest( getlang_Tests, LocaleTime_Tests, TimeRETests, Index: Lib/test/test_whichdb.py =================================================================== --- Lib/test/test_whichdb.py (revision 62290) +++ Lib/test/test_whichdb.py (working copy) @@ -4,13 +4,13 @@ """ import os -import test.test_support +import test.support import unittest import whichdb import anydbm import glob -_fname = test.test_support.TESTFN +_fname = test.support.TESTFN def _delete_files(): # we don't know the precise name the underlying database uses @@ -57,7 +57,7 @@ def test_main(): try: - test.test_support.run_unittest(WhichDBTestCase) + test.support.run_unittest(WhichDBTestCase) finally: _delete_files() Index: Lib/test/test_eof.py =================================================================== --- Lib/test/test_eof.py (revision 62290) +++ Lib/test/test_eof.py (working copy) @@ -2,7 +2,7 @@ """test script for a few new invalid token catches""" import unittest -from test import test_support +from test import support class EOFTestCase(unittest.TestCase): def test_EOFC(self): @@ -13,7 +13,7 @@ except SyntaxError, msg: self.assertEqual(str(msg), expect) else: - raise test_support.TestFailed + raise support.TestFailed def test_EOFS(self): expect = "EOF while scanning triple-quoted string (, line 1)" @@ -22,10 +22,10 @@ except SyntaxError, msg: self.assertEqual(str(msg), expect) else: - raise test_support.TestFailed + raise support.TestFailed def test_main(): - test_support.run_unittest(EOFTestCase) + support.run_unittest(EOFTestCase) if __name__ == "__main__": test_main() Index: Lib/test/test_calendar.py =================================================================== --- Lib/test/test_calendar.py (revision 62290) +++ Lib/test/test_calendar.py (working copy) @@ -1,7 +1,7 @@ import calendar import unittest -from test import test_support +from test import support result_2004_text = """ @@ -381,7 +381,7 @@ def test_main(): - test_support.run_unittest( + support.run_unittest( OutputTestCase, CalendarTestCase, MondayTestCase, Index: Lib/test/test_epoll.py =================================================================== --- Lib/test/test_epoll.py (revision 62290) +++ Lib/test/test_epoll.py (working copy) @@ -29,15 +29,15 @@ import tempfile import unittest -from test import test_support +from test import support if not hasattr(select, "epoll"): - raise test_support.TestSkipped("test works only on Linux 2.6") + raise support.TestSkipped("test works only on Linux 2.6") try: select.epoll() except IOError, e: if e.errno == errno.ENOSYS: - raise test_support.TestSkipped("kernel doesn't support epoll()") + raise support.TestSkipped("kernel doesn't support epoll()") class TestEPoll(unittest.TestCase): @@ -189,7 +189,7 @@ ep.unregister(fd) def test_main(): - test_support.run_unittest(TestEPoll) + support.run_unittest(TestEPoll) if __name__ == "__main__": test_main() Index: Lib/test/test_zipfile64.py =================================================================== --- Lib/test/test_zipfile64.py (revision 62290) +++ Lib/test/test_zipfile64.py (working copy) @@ -1,11 +1,11 @@ # Tests of the full ZIP64 functionality of zipfile -# The test_support.requires call is the only reason for keeping this separate +# The support.requires call is the only reason for keeping this separate # from test_zipfile -from test import test_support +from test import support # XXX(nnorwitz): disable this test by looking for extra largfile resource # which doesn't exist. This test takes over 30 minutes to run in general # and requires more disk space than most of the buildbots. -test_support.requires( +support.requires( 'extralargefile', 'test requires loads of disk-space bytes and a long time to run' ) @@ -22,7 +22,7 @@ from tempfile import TemporaryFile -from test.test_support import TESTFN, run_unittest +from test.support import TESTFN, run_unittest TESTFN2 = TESTFN + "2" Index: Lib/test/test_sets.py =================================================================== --- Lib/test/test_sets.py (revision 62290) +++ Lib/test/test_sets.py (working copy) @@ -6,7 +6,7 @@ import unittest, operator, copy, pickle, random from sets import Set, ImmutableSet -from test import test_support +from test import support empty_set = Set() @@ -825,7 +825,7 @@ def test_main(verbose=None): import doctest from test import test_sets - test_support.run_unittest( + support.run_unittest( TestSetOfSets, TestExceptionPropagation, TestBasicOpsEmpty, Index: Lib/test/test_htmlparser.py =================================================================== --- Lib/test/test_htmlparser.py (revision 62290) +++ Lib/test/test_htmlparser.py (working copy) @@ -3,7 +3,7 @@ import HTMLParser import pprint import unittest -from test import test_support +from test import support class EventCollector(HTMLParser.HTMLParser): @@ -315,7 +315,7 @@ def test_main(): - test_support.run_unittest(HTMLParserTestCase) + support.run_unittest(HTMLParserTestCase) if __name__ == "__main__": Index: Lib/test/test_binascii.py =================================================================== --- Lib/test/test_binascii.py (revision 62290) +++ Lib/test/test_binascii.py (working copy) @@ -1,6 +1,6 @@ """Test the binascii C module.""" -from test import test_support +from test import support import unittest import binascii @@ -123,7 +123,7 @@ self.assertRaises(TypeError, binascii.a2b_hex, t[:-1] + 'q') # Verify the treatment of Unicode strings - if test_support.have_unicode: + if support.have_unicode: self.assertEqual(binascii.hexlify(unicode('a', 'ascii')), '61') def test_qp(self): @@ -168,7 +168,7 @@ binascii.crc_hqx('', 0) def test_main(): - test_support.run_unittest(BinASCIITest) + support.run_unittest(BinASCIITest) if __name__ == "__main__": test_main() Index: Lib/test/test_dummy_thread.py =================================================================== --- Lib/test/test_dummy_thread.py (revision 62290) +++ Lib/test/test_dummy_thread.py (working copy) @@ -10,7 +10,7 @@ import Queue import random import unittest -from test import test_support +from test import support DELAY = 0 # Set > 0 when testing a module other than dummy_thread, such as # the 'thread' module. @@ -71,13 +71,13 @@ self.lock.acquire() start_time = int(time.time()) _thread.start_new_thread(delay_unlock,(self.lock, DELAY)) - if test_support.verbose: + if support.verbose: print print "*** Waiting for thread to release the lock "\ "(approx. %s sec.) ***" % DELAY self.lock.acquire() end_time = int(time.time()) - if test_support.verbose: + if support.verbose: print "done" self.failUnless((end_time - start_time) >= DELAY, "Blocking by unconditional acquiring failed.") @@ -149,7 +149,7 @@ thread_count = 5 testing_queue = Queue.Queue(thread_count) - if test_support.verbose: + if support.verbose: print print "*** Testing multiple thread creation "\ "(will take approx. %s to %s sec.) ***" % (DELAY, thread_count) @@ -161,7 +161,7 @@ _thread.start_new_thread(queue_mark, (testing_queue, local_delay)) time.sleep(DELAY) - if test_support.verbose: + if support.verbose: print 'done' self.failUnless(testing_queue.qsize() == thread_count, "Not all %s threads executed properly after %s sec." % @@ -172,10 +172,10 @@ if imported_module: _thread = imported_module DELAY = 2 - if test_support.verbose: + if support.verbose: print print "*** Using %s as _thread module ***" % _thread - test_support.run_unittest(LockTests, MiscTests, ThreadTests) + support.run_unittest(LockTests, MiscTests, ThreadTests) if __name__ == '__main__': test_main() Index: Lib/test/test_MimeWriter.py =================================================================== --- Lib/test/test_MimeWriter.py (revision 62290) +++ Lib/test/test_MimeWriter.py (working copy) @@ -8,7 +8,7 @@ """ import unittest, StringIO -from test.test_support import run_unittest +from test.support import run_unittest import warnings warnings.filterwarnings("ignore", "the MimeWriter module is deprecated.*", Index: Lib/test/test_xml_etree_c.py =================================================================== --- Lib/test/test_xml_etree_c.py (revision 62290) +++ Lib/test/test_xml_etree_c.py (working copy) @@ -3,7 +3,7 @@ import doctest import sys -from test import test_support +from test import support from xml.etree import cElementTree as ET @@ -218,7 +218,7 @@ def test_main(): from test import test_xml_etree_c - test_support.run_doctest(test_xml_etree_c, verbosity=True) + support.run_doctest(test_xml_etree_c, verbosity=True) if __name__ == '__main__': test_main() Index: Lib/test/test_datetime.py =================================================================== --- Lib/test/test_datetime.py (revision 62290) +++ Lib/test/test_datetime.py (working copy) @@ -8,7 +8,7 @@ import cPickle import unittest -from test import test_support +from test import support from datetime import MINYEAR, MAXYEAR from datetime import timedelta @@ -3325,7 +3325,7 @@ self.assertEqual(datetime_sc, as_datetime) def test_main(): - test_support.run_unittest(__name__) + support.run_unittest(__name__) if __name__ == "__main__": test_main() Index: Lib/test/test_future3.py =================================================================== --- Lib/test/test_future3.py (revision 62290) +++ Lib/test/test_future3.py (working copy) @@ -2,7 +2,7 @@ from __future__ import division import unittest -from test import test_support +from test import support x = 2 def nester(): @@ -24,7 +24,7 @@ self.assertEqual(nester(), 3) def test_main(): - test_support.run_unittest(TestFuture) + support.run_unittest(TestFuture) if __name__ == "__main__": test_main() Index: Lib/test/test_scriptpackages.py =================================================================== --- Lib/test/test_scriptpackages.py (revision 62290) +++ Lib/test/test_scriptpackages.py (working copy) @@ -1,7 +1,7 @@ # Copyright (C) 2003 Python Software Foundation import unittest -from test import test_support +from test import support import aetools class TestScriptpackages(unittest.TestCase): @@ -42,7 +42,7 @@ self._test_scriptpackage('CodeWarrior') def test_main(): - test_support.run_unittest(TestScriptpackages) + support.run_unittest(TestScriptpackages) if __name__ == '__main__': Index: Lib/test/test_decorators.py =================================================================== --- Lib/test/test_decorators.py (revision 62290) +++ Lib/test/test_decorators.py (working copy) @@ -1,5 +1,5 @@ import unittest -from test import test_support +from test import support def funcattrs(**kwds): def decorate(func): @@ -302,8 +302,8 @@ self.assertEqual(C.extra, 'second') def test_main(): - test_support.run_unittest(TestDecorators) - test_support.run_unittest(TestClassDecorators) + support.run_unittest(TestDecorators) + support.run_unittest(TestClassDecorators) if __name__=="__main__": test_main() Index: Lib/test/test_wsgiref.py =================================================================== --- Lib/test/test_wsgiref.py (revision 62290) +++ Lib/test/test_wsgiref.py (working copy) @@ -11,7 +11,7 @@ from SocketServer import BaseServer import re, sys -from test import test_support +from test import support class MockServer(WSGIServer): """Non-socket HTTP server""" @@ -576,7 +576,7 @@ # This epilogue is needed for compatibility with the Python 2.5 regrtest module def test_main(): - test_support.run_unittest(__name__) + support.run_unittest(__name__) if __name__ == "__main__": test_main() Index: Lib/test/test_index.py =================================================================== --- Lib/test/test_index.py (revision 62290) +++ Lib/test/test_index.py (working copy) @@ -1,8 +1,8 @@ import unittest -from test import test_support +from test import support import operator from sys import maxint -maxsize = test_support.MAX_Py_ssize_t +maxsize = support.MAX_Py_ssize_t minsize = -maxsize-1 class oldstyle: @@ -211,7 +211,7 @@ def test_main(): - test_support.run_unittest( + support.run_unittest( BaseTestCase, ListTestCase, TupleTestCase, Index: Lib/test/test_email_codecs.py =================================================================== --- Lib/test/test_email_codecs.py (revision 62290) +++ Lib/test/test_email_codecs.py (working copy) @@ -4,12 +4,12 @@ # The specific tests now live in Lib/email/test from email.test import test_email_codecs from email.test import test_email_codecs_renamed -from test import test_support +from test import support def test_main(): suite = test_email_codecs.suite() suite.addTest(test_email_codecs_renamed.suite()) - test_support.run_unittest(suite) + support.run_unittest(suite) if __name__ == '__main__': test_main() Index: Lib/test/test_socket_ssl.py =================================================================== --- Lib/test/test_socket_ssl.py (revision 62290) +++ Lib/test/test_socket_ssl.py (working copy) @@ -2,7 +2,7 @@ import sys import unittest -from test import test_support +from test import support import socket import errno import threading @@ -20,7 +20,7 @@ # Optionally test SSL support, if we have it in the tested platform skip_expected = not hasattr(socket, "ssl") -HOST = test_support.HOST +HOST = support.HOST class ConnectedTests(unittest.TestCase): @@ -47,7 +47,7 @@ print "didn't raise TypeError" socket.RAND_add("this is a random string", 75.0) - with test_support.transient_internet(): + with support.transient_internet(): f = self.urlopen('https://sf.net') buf = f.read() f.close() @@ -90,7 +90,7 @@ listener_ready = threading.Event() listener_gone = threading.Event() sock = socket.socket() - port = test_support.bind_port(sock) + port = support.bind_port(sock) # `listener` runs in a thread. It opens a socket and sits in accept() # until the main thread connects. Then it rudely closes the socket, @@ -113,7 +113,7 @@ except socket.sslerror: pass else: - raise test_support.TestFailed( + raise support.TestFailed( 'connecting to closed SSL socket should have failed') t = threading.Thread(target=listener, args=(sock,)) @@ -135,13 +135,13 @@ raise last_exc def test_978833(self): - if not test_support.is_resource_enabled("network"): + if not support.is_resource_enabled("network"): return - if test_support.verbose: + if support.verbose: print "test_978833 ..." import os, httplib, ssl - with test_support.transient_internet(): + with support.transient_internet(): s = socket.socket(socket.AF_INET) try: self.connect(s, ("svn.python.org", 443)) @@ -161,7 +161,7 @@ except OSError: pass else: - raise test_support.TestFailed("Failed to close socket") + raise support.TestFailed("Failed to close socket") class OpenSSLTests(unittest.TestCase): @@ -212,7 +212,7 @@ try: # XXX TODO: on Windows, this should make more effort to use the # openssl.exe that would have been built by the pcbuild.sln. - OpenSSLServer.PORT = test_support.find_unused_port() + OpenSSLServer.PORT = support.find_unused_port() args = (OpenSSLServer.PORT, cert_file, key_file) cmd = "openssl s_server -accept %d -cert %s -key %s -quiet" % args self.s = subprocess.Popen(cmd.split(), stdin=subprocess.PIPE, @@ -251,11 +251,11 @@ def test_main(): if not hasattr(socket, "ssl"): - raise test_support.TestSkipped("socket module has no ssl support") + raise support.TestSkipped("socket module has no ssl support") tests = [BasicTests] - if test_support.is_resource_enabled('network'): + if support.is_resource_enabled('network'): tests.append(ConnectedTests) # in these platforms we can kill the openssl process @@ -269,15 +269,15 @@ else: server = None - thread_info = test_support.threading_setup() + thread_info = support.threading_setup() try: - test_support.run_unittest(*tests) + support.run_unittest(*tests) finally: if server is not None and server.haveServer: server.shutdown() - test_support.threading_cleanup(*thread_info) + support.threading_cleanup(*thread_info) if __name__ == "__main__": test_main() Index: Lib/test/test_contextlib.py =================================================================== --- Lib/test/test_contextlib.py (revision 62290) +++ Lib/test/test_contextlib.py (working copy) @@ -9,7 +9,7 @@ import unittest import threading from contextlib import * # Tests __all__ -from test import test_support +from test import support class ContextManagerTestCase(unittest.TestCase): @@ -332,7 +332,7 @@ # This is needed to make the test actually run under regrtest.py! def test_main(): - test_support.run_unittest(__name__) + support.run_unittest(__name__) if __name__ == "__main__": test_main() Index: Lib/test/test_macpath.py =================================================================== --- Lib/test/test_macpath.py (revision 62290) +++ Lib/test/test_macpath.py (working copy) @@ -1,5 +1,5 @@ import macpath -from test import test_support +from test import support import unittest @@ -56,7 +56,7 @@ def test_main(): - test_support.run_unittest(MacPathTestCase) + support.run_unittest(MacPathTestCase) if __name__ == "__main__": Index: Lib/test/test_fnmatch.py =================================================================== --- Lib/test/test_fnmatch.py (revision 62290) +++ Lib/test/test_fnmatch.py (working copy) @@ -1,6 +1,6 @@ """Test cases for the fnmatch module.""" -from test import test_support +from test import support import unittest from fnmatch import fnmatch, fnmatchcase @@ -39,7 +39,7 @@ def test_main(): - test_support.run_unittest(FnmatchTestCase) + support.run_unittest(FnmatchTestCase) if __name__ == "__main__": Index: Lib/test/test_pipes.py =================================================================== --- Lib/test/test_pipes.py (revision 62290) +++ Lib/test/test_pipes.py (working copy) @@ -2,7 +2,7 @@ import os import string import unittest -from test.test_support import TESTFN, run_unittest, unlink, TestSkipped +from test.support import TESTFN, run_unittest, unlink, TestSkipped if os.name != 'posix': raise TestSkipped('pipes module only works on posix') Index: Lib/test/test_imageop.py =================================================================== --- Lib/test/test_imageop.py (revision 62290) +++ Lib/test/test_imageop.py (working copy) @@ -5,7 +5,7 @@ Roger E. Masse """ -from test.test_support import verbose, unlink +from test.support import verbose, unlink import imageop, uu, os, imgfile Index: Lib/test/test_module.py =================================================================== --- Lib/test/test_module.py (revision 62290) +++ Lib/test/test_module.py (working copy) @@ -1,6 +1,6 @@ # Test the module type import unittest -from test.test_support import run_unittest +from test.support import run_unittest import sys ModuleType = type(sys) Index: Lib/test/test_unicode_file.py =================================================================== --- Lib/test/test_unicode_file.py (revision 62290) +++ Lib/test/test_unicode_file.py (working copy) @@ -5,8 +5,8 @@ import unicodedata import unittest -from test.test_support import run_unittest, TestSkipped, TESTFN_UNICODE -from test.test_support import TESTFN_ENCODING, TESTFN_UNICODE_UNENCODEABLE +from test.support import run_unittest, TestSkipped, TESTFN_UNICODE +from test.support import TESTFN_ENCODING, TESTFN_UNICODE_UNENCODEABLE try: TESTFN_ENCODED = TESTFN_UNICODE.encode(TESTFN_ENCODING) except (UnicodeError, TypeError): @@ -16,7 +16,7 @@ if TESTFN_ENCODED.decode(TESTFN_ENCODING) != TESTFN_UNICODE: # The file system encoding does not support Latin-1 - # (which test_support assumes), so try the file system + # (which support assumes), so try the file system # encoding instead. import sys try: Index: Lib/test/test_grammar.py =================================================================== --- Lib/test/test_grammar.py (revision 62290) +++ Lib/test/test_grammar.py (working copy) @@ -8,7 +8,7 @@ # regression test, the filterwarnings() call has been added to # regrtest.py. -from test.test_support import run_unittest, check_syntax_error +from test.support import run_unittest, check_syntax_error import unittest import sys # testing import * Index: Lib/test/test_normalization.py =================================================================== --- Lib/test/test_normalization.py (revision 62290) +++ Lib/test/test_normalization.py (working copy) @@ -1,4 +1,4 @@ -from test.test_support import run_unittest, open_urlresource +from test.support import run_unittest, open_urlresource import unittest import sys Index: Lib/test/test_shelve.py =================================================================== --- Lib/test/test_shelve.py (revision 62290) +++ Lib/test/test_shelve.py (working copy) @@ -2,7 +2,7 @@ import unittest import shelve import glob -from test import test_support +from test import support class TestCase(unittest.TestCase): @@ -99,7 +99,7 @@ self._db = [] if not self._in_mem: for f in glob.glob(self.fn+"*"): - test_support.unlink(f) + support.unlink(f) class TestAsciiFileShelve(TestShelveBase): _args={'protocol':0} @@ -121,7 +121,7 @@ _in_mem = True def test_main(): - test_support.run_unittest( + support.run_unittest( TestAsciiFileShelve, TestBinaryFileShelve, TestProto2FileShelve, Index: Lib/test/test_codecmaps_jp.py =================================================================== --- Lib/test/test_codecmaps_jp.py (revision 62290) +++ Lib/test/test_codecmaps_jp.py (working copy) @@ -4,7 +4,7 @@ # Codec mapping tests for Japanese encodings # -from test import test_support +from test import support from test import test_multibytecodec_support import unittest @@ -61,7 +61,7 @@ def test_main(): - test_support.run_unittest(__name__) + support.run_unittest(__name__) if __name__ == "__main__": test_main() Index: Lib/test/test_hotshot.py =================================================================== --- Lib/test/test_hotshot.py (revision 62290) +++ Lib/test/test_hotshot.py (working copy) @@ -4,7 +4,7 @@ import pprint import unittest -from test import test_support +from test import support from hotshot.log import ENTER, EXIT, LINE @@ -38,7 +38,7 @@ class HotShotTestCase(unittest.TestCase): def new_profiler(self, lineevents=0, linetimings=1): - self.logfn = test_support.TESTFN + self.logfn = support.TESTFN return hotshot.Profile(self.logfn, lineevents, linetimings) def get_logreader(self): @@ -115,17 +115,17 @@ try: # verify we require a list for sys.path sys.path = 'abc' - self.assertRaises(RuntimeError, coverage, test_support.TESTFN) + self.assertRaises(RuntimeError, coverage, support.TESTFN) # verify that we require sys.path exists del sys.path - self.assertRaises(RuntimeError, coverage, test_support.TESTFN) + self.assertRaises(RuntimeError, coverage, support.TESTFN) finally: sys.path = orig_path - if os.path.exists(test_support.TESTFN): - os.remove(test_support.TESTFN) + if os.path.exists(support.TESTFN): + os.remove(support.TESTFN) def test_main(): - test_support.run_unittest(HotShotTestCase) + support.run_unittest(HotShotTestCase) if __name__ == "__main__": Index: Lib/test/test_largefile.py =================================================================== --- Lib/test/test_largefile.py (revision 62290) +++ Lib/test/test_largefile.py (working copy) @@ -5,7 +5,7 @@ import stat import sys import unittest -from test.test_support import run_unittest, TESTFN, verbose, requires, \ +from test.support import run_unittest, TESTFN, verbose, requires, \ TestSkipped, unlink try: Index: Lib/test/test_pwd.py =================================================================== --- Lib/test/test_pwd.py (revision 62290) +++ Lib/test/test_pwd.py (working copy) @@ -1,5 +1,5 @@ import unittest -from test import test_support +from test import support import pwd @@ -91,7 +91,7 @@ self.assertRaises(KeyError, pwd.getpwuid, fakeuid) def test_main(): - test_support.run_unittest(PwdTest) + support.run_unittest(PwdTest) if __name__ == "__main__": test_main() Index: Lib/test/test_mutants.py =================================================================== --- Lib/test/test_mutants.py (revision 62290) +++ Lib/test/test_mutants.py (working copy) @@ -1,4 +1,4 @@ -from test.test_support import verbose, TESTFN +from test.support import verbose, TESTFN import random import os Index: Lib/test/test_decimal.py =================================================================== --- Lib/test/test_decimal.py (revision 62290) +++ Lib/test/test_decimal.py (working copy) @@ -31,7 +31,7 @@ import pickle, copy import unittest from decimal import * -from test.test_support import (TestSkipped, run_unittest, run_doctest, +from test.support import (TestSkipped, run_unittest, run_doctest, is_resource_enabled) import random try: Index: Lib/test/test_difflib.py =================================================================== --- Lib/test/test_difflib.py (revision 62290) +++ Lib/test/test_difflib.py (working copy) @@ -1,5 +1,5 @@ import difflib -from test.test_support import run_unittest, findfile +from test.support import run_unittest, findfile import unittest import doctest import sys Index: Lib/test/test_undocumented_details.py =================================================================== --- Lib/test/test_undocumented_details.py (revision 62290) +++ Lib/test/test_undocumented_details.py (working copy) @@ -1,4 +1,4 @@ -from test.test_support import run_unittest, have_unicode +from test.support import run_unittest, have_unicode import unittest import sys Index: Lib/test/test_xpickle.py =================================================================== --- Lib/test/test_xpickle.py (revision 62290) +++ Lib/test/test_xpickle.py (working copy) @@ -6,7 +6,7 @@ import pickle import cPickle -from test import test_support +from test import support from test.pickletester import AbstractPickleTests class DumpCPickle_LoadPickle(AbstractPickleTests): @@ -34,7 +34,7 @@ return cPickle.loads(buf) def test_main(): - test_support.run_unittest( + support.run_unittest( DumpCPickle_LoadPickle, DumpPickle_LoadCPickle ) Index: Lib/test/test_commands.py =================================================================== --- Lib/test/test_commands.py (revision 62290) +++ Lib/test/test_commands.py (working copy) @@ -9,7 +9,7 @@ warnings.filterwarnings('ignore', r".*commands.getstatus.. is deprecated", DeprecationWarning) -from test.test_support import TestSkipped, run_unittest, reap_children +from test.support import TestSkipped, run_unittest, reap_children from commands import * # The module says: Index: Lib/test/test_wave.py =================================================================== --- Lib/test/test_wave.py (revision 62290) +++ Lib/test/test_wave.py (working copy) @@ -1,4 +1,4 @@ -from test.test_support import TESTFN, run_unittest +from test.support import TESTFN, run_unittest import os import wave import unittest Index: Lib/test/test_tempfile.py =================================================================== --- Lib/test/test_tempfile.py (revision 62290) +++ Lib/test/test_tempfile.py (working copy) @@ -8,7 +8,7 @@ import warnings import unittest -from test import test_support +from test import support warnings.filterwarnings("ignore", category=RuntimeWarning, @@ -117,7 +117,7 @@ self.failIf(s in dict) dict[s] = 1 - def test_supports_iter(self): + def supports_iter(self): # _RandomNameSequence supports the iterator protocol i = 0 @@ -277,7 +277,7 @@ if not has_spawnl: return # ugh, can't use TestSkipped. - if test_support.verbose: + if support.verbose: v="v" else: v="q" @@ -843,7 +843,7 @@ test_classes.append(test_TemporaryFile) def test_main(): - test_support.run_unittest(*test_classes) + support.run_unittest(*test_classes) if __name__ == "__main__": test_main() Index: Lib/test/test_strop.py =================================================================== --- Lib/test/test_strop.py (revision 62290) +++ Lib/test/test_strop.py (working copy) @@ -4,7 +4,7 @@ r'test.test_strop|unittest') import strop import unittest -from test import test_support +from test import support class StropFunctionTestCase(unittest.TestCase): @@ -127,7 +127,7 @@ def test_main(): - test_support.run_unittest(StropFunctionTestCase) + support.run_unittest(StropFunctionTestCase) if __name__ == "__main__": Index: Lib/test/test_bisect.py =================================================================== --- Lib/test/test_bisect.py (revision 62290) +++ Lib/test/test_bisect.py (working copy) @@ -1,6 +1,6 @@ import sys import unittest -from test import test_support +from test import support from UserList import UserList # We do a bit of trickery here to be able to test both the C implementation @@ -281,15 +281,15 @@ TestInsortPython, TestInsortC, TestErrorHandlingPython, TestErrorHandlingC] - test_support.run_unittest(*test_classes) - test_support.run_doctest(test_bisect, verbose) + support.run_unittest(*test_classes) + support.run_doctest(test_bisect, verbose) # verify reference counting if verbose and hasattr(sys, "gettotalrefcount"): import gc counts = [None] * 5 for i in xrange(len(counts)): - test_support.run_unittest(*test_classes) + support.run_unittest(*test_classes) gc.collect() counts[i] = sys.gettotalrefcount() print counts Index: Lib/test/test_threaded_import.py =================================================================== --- Lib/test/test_threaded_import.py (revision 62290) +++ Lib/test/test_threaded_import.py (working copy) @@ -6,7 +6,7 @@ # randrange, and then Python hangs. import thread -from test.test_support import verbose, TestSkipped, TestFailed +from test.support import verbose, TestSkipped, TestFailed critical_section = thread.allocate_lock() done = thread.allocate_lock() Index: Lib/test/test_multibytecodec.py =================================================================== --- Lib/test/test_multibytecodec.py (revision 62290) +++ Lib/test/test_multibytecodec.py (working copy) @@ -4,9 +4,9 @@ # Unit test for multibytecodec itself # -from test import test_support +from test import support from test import test_multibytecodec_support -from test.test_support import TESTFN +from test.support import TESTFN import unittest, StringIO, codecs, sys, os ALL_CJKENCODINGS = [ @@ -229,7 +229,7 @@ myunichr(x).encode('iso_2022_jp', 'ignore') def test_main(): - test_support.run_unittest(__name__) + support.run_unittest(__name__) if __name__ == "__main__": test_main() Index: Lib/test/test_ftplib.py =================================================================== --- Lib/test/test_ftplib.py (revision 62290) +++ Lib/test/test_ftplib.py (working copy) @@ -4,9 +4,9 @@ import time from unittest import TestCase -from test import test_support +from test import support -HOST = test_support.HOST +HOST = support.HOST # This function sets the evt 3 times: # 1) when the connection is ready to be accepted. @@ -36,7 +36,7 @@ self.evt = threading.Event() self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.sock.settimeout(3) - self.port = test_support.bind_port(self.sock) + self.port = support.bind_port(self.sock) threading.Thread(target=server, args=(self.evt,self.sock)).start() # Wait for the server to be ready. self.evt.wait() @@ -105,7 +105,7 @@ def test_main(verbose=None): - test_support.run_unittest(GeneralTests) + support.run_unittest(GeneralTests) if __name__ == '__main__': test_main() Index: Lib/test/test_random.py =================================================================== --- Lib/test/test_random.py (revision 62290) +++ Lib/test/test_random.py (working copy) @@ -6,7 +6,7 @@ import pickle import warnings from math import log, exp, sqrt, pi -from test import test_support +from test import support class TestBasicOps(unittest.TestCase): # Superclass with tests common to all generators. @@ -148,7 +148,7 @@ ("randv2_64.pck", 866), ("randv3.pck", 343)] for file, value in files: - f = open(test_support.findfile(file),"rb") + f = open(support.findfile(file),"rb") r = pickle.load(f) f.close() self.assertEqual(r.randrange(1000), value) @@ -191,7 +191,7 @@ def test_bigrand(self): # Verify warnings are raised when randrange is too large for random() - with test_support.catch_warning(): + with support.catch_warning(): warnings.filterwarnings("error", "Underlying random") self.assertRaises(UserWarning, self.gen.randrange, 2**60) @@ -551,14 +551,14 @@ else: testclasses.append(SystemRandom_TestBasicOps) - test_support.run_unittest(*testclasses) + support.run_unittest(*testclasses) # verify reference counting import sys if verbose and hasattr(sys, "gettotalrefcount"): counts = [None] * 5 for i in xrange(len(counts)): - test_support.run_unittest(*testclasses) + support.run_unittest(*testclasses) counts[i] = sys.gettotalrefcount() print counts Index: Lib/test/test_codecencodings_tw.py =================================================================== --- Lib/test/test_codecencodings_tw.py (revision 62290) +++ Lib/test/test_codecencodings_tw.py (working copy) @@ -4,7 +4,7 @@ # Codec encoding tests for ROC encodings. # -from test import test_support +from test import support from test import test_multibytecodec_support import unittest @@ -21,7 +21,7 @@ ) def test_main(): - test_support.run_unittest(__name__) + support.run_unittest(__name__) if __name__ == "__main__": test_main() Index: Lib/test/test_pep292.py =================================================================== --- Lib/test/test_pep292.py (revision 62290) +++ Lib/test/test_pep292.py (working copy) @@ -185,9 +185,9 @@ def test_main(): - from test import test_support + from test import support test_classes = [TestTemplate,] - test_support.run_unittest(*test_classes) + support.run_unittest(*test_classes) if __name__ == '__main__': Index: Lib/test/test_telnetlib.py =================================================================== --- Lib/test/test_telnetlib.py (revision 62290) +++ Lib/test/test_telnetlib.py (working copy) @@ -4,9 +4,9 @@ import time from unittest import TestCase -from test import test_support +from test import support -HOST = test_support.HOST +HOST = support.HOST def server(evt, serv): serv.listen(5) @@ -25,7 +25,7 @@ self.evt = threading.Event() self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.sock.settimeout(3) - self.port = test_support.bind_port(self.sock) + self.port = support.bind_port(self.sock) threading.Thread(target=server, args=(self.evt,self.sock)).start() self.evt.wait() self.evt.clear() @@ -71,7 +71,7 @@ def test_main(verbose=None): - test_support.run_unittest(GeneralTests) + support.run_unittest(GeneralTests) if __name__ == '__main__': test_main() Index: Lib/test/test_base64.py =================================================================== --- Lib/test/test_base64.py (revision 62290) +++ Lib/test/test_base64.py (working copy) @@ -1,5 +1,5 @@ import unittest -from test import test_support +from test import support import base64 @@ -184,7 +184,7 @@ def test_main(): - test_support.run_unittest(__name__) + support.run_unittest(__name__) if __name__ == '__main__': test_main() Index: Lib/test/test_struct.py =================================================================== --- Lib/test/test_struct.py (revision 62290) +++ Lib/test/test_struct.py (working copy) @@ -1,5 +1,5 @@ -from test.test_support import TestFailed, verbose, verify, vereq -import test.test_support +from test.support import TestFailed, verbose, verify, vereq +import test.support import struct import array import warnings @@ -50,7 +50,7 @@ def with_warning_restore(func): def _with_warning_restore(*args, **kw): - with test.test_support.catch_warning(): + with test.support.catch_warning(): # Grrr, we need this function to warn every time. Without removing # the warningregistry, running test_tarfile then test_struct would fail # on 64-bit platforms. Index: Lib/test/test_weakref.py =================================================================== --- Lib/test/test_weakref.py (revision 62290) +++ Lib/test/test_weakref.py (working copy) @@ -4,7 +4,7 @@ import UserList import weakref -from test import test_support +from test import support # Used in ReferencesTestCase.test_ref_created_during_del() . ref_from_del = None @@ -1145,13 +1145,13 @@ __test__ = {'libreftest' : libreftest} def test_main(): - test_support.run_unittest( + support.run_unittest( ReferencesTestCase, MappingTestCase, WeakValueDictionaryTestCase, WeakKeyDictionaryTestCase, ) - test_support.run_doctest(sys.modules[__name__]) + support.run_doctest(sys.modules[__name__]) if __name__ == "__main__": Index: Lib/test/test_enumerate.py =================================================================== --- Lib/test/test_enumerate.py (revision 62290) +++ Lib/test/test_enumerate.py (working copy) @@ -1,7 +1,7 @@ import unittest import sys -from test import test_support +from test import support class G: 'Sequence using __getitem__' @@ -199,14 +199,14 @@ def test_main(verbose=None): testclasses = (EnumerateTestCase, SubclassTestCase, TestEmpty, TestBig, TestReversed) - test_support.run_unittest(*testclasses) + support.run_unittest(*testclasses) # verify reference counting import sys if verbose and hasattr(sys, "gettotalrefcount"): counts = [None] * 5 for i in xrange(len(counts)): - test_support.run_unittest(*testclasses) + support.run_unittest(*testclasses) counts[i] = sys.gettotalrefcount() print counts Index: Lib/test/test_codecencodings_cn.py =================================================================== --- Lib/test/test_codecencodings_cn.py (revision 62290) +++ Lib/test/test_codecencodings_cn.py (working copy) @@ -4,7 +4,7 @@ # Codec encoding tests for PRC encodings. # -from test import test_support +from test import support from test import test_multibytecodec_support import unittest @@ -51,7 +51,7 @@ has_iso10646 = True def test_main(): - test_support.run_unittest(__name__) + support.run_unittest(__name__) if __name__ == "__main__": test_main() Index: Lib/test/test_subprocess.py =================================================================== --- Lib/test/test_subprocess.py (revision 62290) +++ Lib/test/test_subprocess.py (working copy) @@ -1,5 +1,5 @@ import unittest -from test import test_support +from test import support import subprocess import sys import signal @@ -30,14 +30,14 @@ def setUp(self): # Try to minimize the number of children we have so this test # doesn't crash on some buildbots (Alphas in particular). - if hasattr(test_support, "reap_children"): - test_support.reap_children() + if hasattr(support, "reap_children"): + support.reap_children() def tearDown(self): # Try to minimize the number of children we have so this test # doesn't crash on some buildbots (Alphas in particular). - if hasattr(test_support, "reap_children"): - test_support.reap_children() + if hasattr(support, "reap_children"): + support.reap_children() def mkstemp(self): """wrapper for mkstemp, calling mktemp if mkstemp is not available""" @@ -402,8 +402,8 @@ def test_no_leaking(self): # Make sure we leak no resources - if not hasattr(test_support, "is_resource_enabled") \ - or test_support.is_resource_enabled("subprocess") and not mswindows: + if not hasattr(support, "is_resource_enabled") \ + or support.is_resource_enabled("subprocess") and not mswindows: max_handles = 1026 # too much for most UNIX systems else: max_handles = 65 @@ -657,9 +657,9 @@ def test_main(): - test_support.run_unittest(ProcessTestCase) - if hasattr(test_support, "reap_children"): - test_support.reap_children() + support.run_unittest(ProcessTestCase) + if hasattr(support, "reap_children"): + support.reap_children() if __name__ == "__main__": test_main() Index: Lib/test/string_tests.py =================================================================== --- Lib/test/string_tests.py (revision 62290) +++ Lib/test/string_tests.py (working copy) @@ -3,7 +3,7 @@ """ import unittest, string, sys, struct -from test import test_support +from test import support from UserList import UserList class Sequence: @@ -479,7 +479,7 @@ self.checkequal('hello', 'hello', 'strip', 'xyz') # strip/lstrip/rstrip with unicode arg - if test_support.have_unicode: + if support.have_unicode: self.checkequal(unicode('hello', 'ascii'), 'xyzzyhelloxyzzy', 'strip', unicode('xyz', 'ascii')) self.checkequal(unicode('helloxyzzy', 'ascii'), 'xyzzyhelloxyzzy', @@ -995,7 +995,7 @@ self.checkequal('w x y z', ' ', 'join', Sequence()) self.checkequal('abc', 'a', 'join', ('abc',)) self.checkequal('z', 'a', 'join', UserList(['z'])) - if test_support.have_unicode: + if support.have_unicode: self.checkequal(unicode('a.b.c'), unicode('.'), 'join', ['a', 'b', 'c']) self.checkequal(unicode('a.b.c'), '.', 'join', [unicode('a'), 'b', 'c']) self.checkequal(unicode('a.b.c'), '.', 'join', ['a', unicode('b'), 'c']) @@ -1163,7 +1163,7 @@ # Additional tests that only work with # 8bit compatible object, i.e. str and UserString - if test_support.have_unicode: + if support.have_unicode: def test_encoding_decoding(self): codecs = [('rot13', 'uryyb jbeyq'), ('base64', 'aGVsbG8gd29ybGQ=\n'), Index: Lib/test/test_old_mailbox.py =================================================================== --- Lib/test/test_old_mailbox.py (revision 62290) +++ Lib/test/test_old_mailbox.py (working copy) @@ -5,11 +5,11 @@ import os import time import unittest -from test import test_support +from test import support # cleanup earlier tests try: - os.unlink(test_support.TESTFN) + os.unlink(support.TESTFN) except os.error: pass @@ -26,7 +26,7 @@ def setUp(self): # create a new maildir mailbox to work with: - self._dir = test_support.TESTFN + self._dir = support.TESTFN os.mkdir(self._dir) os.mkdir(os.path.join(self._dir, "cur")) os.mkdir(os.path.join(self._dir, "tmp")) @@ -66,14 +66,14 @@ def test_empty_maildir(self): """Test an empty maildir mailbox""" # Test for regression on bug #117490: - self.mbox = mailbox.Maildir(test_support.TESTFN) + self.mbox = mailbox.Maildir(support.TESTFN) self.assert_(len(self.mbox) == 0) self.assert_(self.mbox.next() is None) self.assert_(self.mbox.next() is None) def test_nonempty_maildir_cur(self): self.createMessage("cur") - self.mbox = mailbox.Maildir(test_support.TESTFN) + self.mbox = mailbox.Maildir(support.TESTFN) self.assert_(len(self.mbox) == 1) self.assert_(self.mbox.next() is not None) self.assert_(self.mbox.next() is None) @@ -81,7 +81,7 @@ def test_nonempty_maildir_new(self): self.createMessage("new") - self.mbox = mailbox.Maildir(test_support.TESTFN) + self.mbox = mailbox.Maildir(support.TESTFN) self.assert_(len(self.mbox) == 1) self.assert_(self.mbox.next() is not None) self.assert_(self.mbox.next() is None) @@ -90,7 +90,7 @@ def test_nonempty_maildir_both(self): self.createMessage("cur") self.createMessage("new") - self.mbox = mailbox.Maildir(test_support.TESTFN) + self.mbox = mailbox.Maildir(support.TESTFN) self.assert_(len(self.mbox) == 2) self.assert_(self.mbox.next() is not None) self.assert_(self.mbox.next() is not None) @@ -112,7 +112,7 @@ class MboxTestCase(unittest.TestCase): def setUp(self): # create a new maildir mailbox to work with: - self._path = test_support.TESTFN + self._path = support.TESTFN def tearDown(self): os.unlink(self._path) @@ -146,7 +146,7 @@ def test_main(): - test_support.run_unittest(MaildirTestCase, MboxTestCase) + support.run_unittest(MaildirTestCase, MboxTestCase) if __name__ == "__main__": Index: Lib/test/test_bool.py =================================================================== --- Lib/test/test_bool.py (revision 62290) +++ Lib/test/test_bool.py (working copy) @@ -1,7 +1,7 @@ # Test properties of bool promised by PEP 285 import unittest -from test import test_support +from test import support import os @@ -26,14 +26,14 @@ def test_print(self): try: - fo = open(test_support.TESTFN, "wb") + fo = open(support.TESTFN, "wb") print >> fo, False, True fo.close() - fo = open(test_support.TESTFN, "rb") + fo = open(support.TESTFN, "rb") self.assertEqual(fo.read(), 'False True\n') finally: fo.close() - os.remove(test_support.TESTFN) + os.remove(support.TESTFN) def test_repr(self): self.assertEqual(repr(False), 'False') @@ -207,7 +207,7 @@ self.assertIs("xyz".startswith("x"), True) self.assertIs("xyz".startswith("z"), False) - if test_support.have_unicode: + if support.have_unicode: self.assertIs(unicode("xyz", 'ascii').endswith(unicode("z", 'ascii')), True) self.assertIs(unicode("xyz", 'ascii').endswith(unicode("x", 'ascii')), False) self.assertIs(unicode("xyz0123", 'ascii').isalnum(), True) @@ -246,12 +246,12 @@ def test_fileclosed(self): try: - f = file(test_support.TESTFN, "w") + f = file(support.TESTFN, "w") self.assertIs(f.closed, False) f.close() self.assertIs(f.closed, True) finally: - os.remove(test_support.TESTFN) + os.remove(support.TESTFN) def test_operator(self): import operator @@ -342,7 +342,7 @@ def test_main(): - test_support.run_unittest(BoolTest) + support.run_unittest(BoolTest) if __name__ == "__main__": test_main() Index: Lib/test/test_zipimport.py =================================================================== --- Lib/test/test_zipimport.py (revision 62290) +++ Lib/test/test_zipimport.py (working copy) @@ -8,7 +8,7 @@ import zlib # implied prerequisite from zipfile import ZipFile, ZipInfo, ZIP_STORED, ZIP_DEFLATED -from test import test_support +from test import support from test.test_importhooks import ImportHooksBaseTestCase, test_src, test_co import zipimport @@ -356,12 +356,12 @@ self.assertZipFailure('A' * 33000) def testEmptyFile(self): - test_support.unlink(TESTMOD) + support.unlink(TESTMOD) open(TESTMOD, 'w+').close() self.assertZipFailure(TESTMOD) def testFileUnreadable(self): - test_support.unlink(TESTMOD) + support.unlink(TESTMOD) fd = os.open(TESTMOD, os.O_CREAT, 000) try: os.close(fd) @@ -370,10 +370,10 @@ # If we leave "the read-only bit" set on Windows, nothing can # delete TESTMOD, and later tests suffer bogus failures. os.chmod(TESTMOD, 0666) - test_support.unlink(TESTMOD) + support.unlink(TESTMOD) def testNotZipFile(self): - test_support.unlink(TESTMOD) + support.unlink(TESTMOD) fp = open(TESTMOD, 'w+') fp.write('a' * 22) fp.close() @@ -381,7 +381,7 @@ # XXX: disabled until this works on Big-endian machines def _testBogusZipFile(self): - test_support.unlink(TESTMOD) + support.unlink(TESTMOD) fp = open(TESTMOD, 'w+') fp.write(struct.pack('=I', 0x06054B50)) fp.write('a' * 18) @@ -422,13 +422,13 @@ def test_main(): cleanup() try: - test_support.run_unittest( + support.run_unittest( UncompressedZipImportTestCase, CompressedZipImportTestCase, BadFileZipImportTestCase, ) finally: - test_support.unlink(TESTMOD) + support.unlink(TESTMOD) if __name__ == "__main__": test_main() Index: Lib/test/test_cmd_line_script.py =================================================================== --- Lib/test/test_cmd_line_script.py (revision 62290) +++ Lib/test/test_cmd_line_script.py (working copy) @@ -5,7 +5,7 @@ import os import os.path import sys -import test.test_support +import test.support import tempfile import subprocess import py_compile @@ -13,9 +13,9 @@ import shutil import zipfile -verbose = test.test_support.verbose +verbose = test.support.verbose -# XXX ncoghlan: Should we consider moving these to test_support? +# XXX ncoghlan: Should we consider moving these to support? from test_cmd_line import _spawn_python, _kill_python def _run_python(*args): @@ -177,8 +177,8 @@ def test_main(): - test.test_support.run_unittest(CmdLineTest) - test.test_support.reap_children() + test.support.run_unittest(CmdLineTest) + test.support.reap_children() if __name__ == '__main__': test_main() Index: Lib/test/test_slice.py =================================================================== --- Lib/test/test_slice.py (revision 62290) +++ Lib/test/test_slice.py (working copy) @@ -1,7 +1,7 @@ # tests for slice objects; in particular the indices method. import unittest -from test import test_support +from test import support from cPickle import loads, dumps import sys @@ -112,7 +112,7 @@ self.assertNotEqual(id(s), id(t)) def test_main(): - test_support.run_unittest(SliceTest) + support.run_unittest(SliceTest) if __name__ == "__main__": test_main() Index: Lib/test/test_coding.py =================================================================== --- Lib/test/test_coding.py (revision 62290) +++ Lib/test/test_coding.py (working copy) @@ -1,5 +1,5 @@ -import test.test_support, unittest +import test.support, unittest import os class CodingTest(unittest.TestCase): @@ -22,7 +22,7 @@ self.assertRaises(SyntaxError, compile, text, filename, 'exec') def test_main(): - test.test_support.run_unittest(CodingTest) + test.support.run_unittest(CodingTest) if __name__ == "__main__": test_main() Index: Lib/test/test_uuid.py =================================================================== --- Lib/test/test_uuid.py (revision 62290) +++ Lib/test/test_uuid.py (working copy) @@ -1,5 +1,5 @@ from unittest import TestCase -from test import test_support +from test import support import uuid def importable(name): @@ -465,7 +465,7 @@ def test_main(): - test_support.run_unittest(TestUUID) + support.run_unittest(TestUUID) if __name__ == '__main__': test_main() Index: Lib/test/test_import.py =================================================================== --- Lib/test/test_import.py (revision 62290) +++ Lib/test/test_import.py (working copy) @@ -1,4 +1,4 @@ -from test.test_support import TESTFN, run_unittest, catch_warning +from test.support import TESTFN, run_unittest, catch_warning import unittest import os @@ -7,7 +7,7 @@ import sys import py_compile import warnings -from test.test_support import unlink, TESTFN, unload +from test.support import unlink, TESTFN, unload def remove_files(name): @@ -208,13 +208,13 @@ def test_import_name_binding(self): # import x.y.z binds x in the current namespace import test as x - import test.test_support + import test.support self.assert_(x is test, x.__name__) - self.assert_(hasattr(test.test_support, "__file__")) + self.assert_(hasattr(test.support, "__file__")) # import x.y.z as w binds z as w - import test.test_support as y - self.assert_(y is test.test_support, y.__name__) + import test.support as y + self.assert_(y is test.support, y.__name__) def test_import_initless_directory_warning(self): with catch_warning(): Index: Lib/test/test_anydbm.py =================================================================== --- Lib/test/test_anydbm.py (revision 62290) +++ Lib/test/test_anydbm.py (working copy) @@ -7,9 +7,9 @@ import unittest import anydbm import glob -from test import test_support +from test import support -_fname = test_support.TESTFN +_fname = support.TESTFN def _delete_files(): # we don't know the precise name the underlying database uses @@ -87,7 +87,7 @@ def test_main(): try: - test_support.run_unittest(AnyDBMTestCase) + support.run_unittest(AnyDBMTestCase) finally: _delete_files() Index: Lib/test/test_netrc.py =================================================================== --- Lib/test/test_netrc.py (revision 62290) +++ Lib/test/test_netrc.py (working copy) @@ -1,6 +1,6 @@ import netrc, os, unittest, sys -from test import test_support +from test import support TEST_NETRC = """ machine foo login log1 password pass1 account acct1 @@ -17,7 +17,7 @@ """ -temp_filename = test_support.TESTFN +temp_filename = support.TESTFN class NetrcTestCase(unittest.TestCase): @@ -42,7 +42,7 @@ self.assert_(self.netrc.hosts['default'] == ('log2', None, 'pass2')) def test_main(): - test_support.run_unittest(NetrcTestCase) + support.run_unittest(NetrcTestCase) if __name__ == "__main__": test_main() Index: Lib/test/test_unittest.py =================================================================== --- Lib/test/test_unittest.py (revision 62290) +++ Lib/test/test_unittest.py (working copy) @@ -6,7 +6,7 @@ TestCase.{assert,fail}* methods (some are tested implicitly) """ -from test import test_support +from test import support import unittest from unittest import TestCase import types @@ -2289,7 +2289,7 @@ ###################################################################### def test_main(): - test_support.run_unittest(Test_TestCase, Test_TestLoader, + support.run_unittest(Test_TestCase, Test_TestLoader, Test_TestSuite, Test_TestResult, Test_FunctionTestCase, Test_Assertions) Index: Lib/test/test_glob.py =================================================================== --- Lib/test/test_glob.py (revision 62290) +++ Lib/test/test_glob.py (working copy) @@ -1,5 +1,5 @@ import unittest -from test.test_support import run_unittest, TESTFN +from test.support import run_unittest, TESTFN import glob import os import shutil Index: Lib/test/test_gettext.py =================================================================== --- Lib/test/test_gettext.py (revision 62290) +++ Lib/test/test_gettext.py (working copy) @@ -4,7 +4,7 @@ import gettext import unittest -from test import test_support +from test import support # TODO: @@ -337,7 +337,7 @@ def test_main(): - test_support.run_unittest(__name__) + support.run_unittest(__name__) if __name__ == '__main__': test_main() Index: Lib/test/test_platform.py =================================================================== --- Lib/test/test_platform.py (revision 62290) +++ Lib/test/test_platform.py (working copy) @@ -1,5 +1,5 @@ import unittest -from test import test_support +from test import support import platform class PlatformTest(unittest.TestCase): @@ -71,7 +71,7 @@ res = platform.libc_ver(executable) def test_main(): - test_support.run_unittest( + support.run_unittest( PlatformTest ) Index: Lib/test/test_property.py =================================================================== --- Lib/test/test_property.py (revision 62290) +++ Lib/test/test_property.py (working copy) @@ -2,7 +2,7 @@ # more tests are in test_descr import unittest -from test.test_support import run_unittest +from test.support import run_unittest class PropertyBase(Exception): pass Index: Lib/test/test_sunaudiodev.py =================================================================== --- Lib/test/test_sunaudiodev.py (revision 62290) +++ Lib/test/test_sunaudiodev.py (working copy) @@ -1,4 +1,4 @@ -from test.test_support import findfile, TestFailed, TestSkipped +from test.support import findfile, TestFailed, TestSkipped import sunaudiodev import os Index: Lib/test/test_timeout.py =================================================================== --- Lib/test/test_timeout.py (revision 62290) +++ Lib/test/test_timeout.py (working copy) @@ -1,10 +1,10 @@ """Unit tests for socket timeout feature.""" import unittest -from test import test_support +from test import support # This requires the 'network' resource as given on the regrtest command line. -skip_expected = not test_support.is_resource_enabled('network') +skip_expected = not support.is_resource_enabled('network') import time import socket @@ -191,8 +191,8 @@ def test_main(): - test_support.requires('network') - test_support.run_unittest(CreationTestCase, TimeoutTestCase) + support.requires('network') + support.run_unittest(CreationTestCase, TimeoutTestCase) if __name__ == "__main__": test_main() Index: Lib/test/test_bytes.py =================================================================== --- Lib/test/test_bytes.py (revision 62290) +++ Lib/test/test_bytes.py (working copy) @@ -13,7 +13,7 @@ import tempfile import unittest import warnings -import test.test_support +import test.support import test.string_tests import test.buffer_tests @@ -969,10 +969,10 @@ self.assertEqual(x, b"abcd") def test_main(): - #test.test_support.run_unittest(BytesTest) - #test.test_support.run_unittest(AssortedBytesTest) - #test.test_support.run_unittest(BytesAsStringTest) - test.test_support.run_unittest( + #test.support.run_unittest(BytesTest) + #test.support.run_unittest(AssortedBytesTest) + #test.support.run_unittest(BytesAsStringTest) + test.support.run_unittest( ByteArrayTest, ByteArrayAsStringTest, ByteArraySubclassTest, Index: Lib/test/test_htmllib.py =================================================================== --- Lib/test/test_htmllib.py (revision 62290) +++ Lib/test/test_htmllib.py (working copy) @@ -2,7 +2,7 @@ import htmllib import unittest -from test import test_support +from test import support class AnchorCollector(htmllib.HTMLParser): @@ -62,7 +62,7 @@ ]) def test_main(): - test_support.run_unittest(HTMLParserTestCase) + support.run_unittest(HTMLParserTestCase) if __name__ == "__main__": Index: Lib/test/test_time.py =================================================================== --- Lib/test/test_time.py (revision 62290) +++ Lib/test/test_time.py (working copy) @@ -1,4 +1,4 @@ -from test import test_support +from test import support import time import unittest @@ -219,7 +219,7 @@ self.assert_(0 <= (t1-t0) < 0.2) def test_main(): - test_support.run_unittest(TimeTestCase) + support.run_unittest(TimeTestCase) if __name__ == "__main__": Index: Lib/test/test_future4.py =================================================================== --- Lib/test/test_future4.py (revision 62290) +++ Lib/test/test_future4.py (working copy) @@ -1,7 +1,7 @@ from __future__ import unicode_literals import unittest -from test import test_support +from test import support class TestFuture(unittest.TestCase): def assertType(self, obj, typ): @@ -41,7 +41,7 @@ self.assertType(u'' u'', unicode) def test_main(): - test_support.run_unittest(TestFuture) + support.run_unittest(TestFuture) if __name__ == "__main__": test_main() Index: Lib/test/test_structmembers.py =================================================================== --- Lib/test/test_structmembers.py (revision 62290) +++ Lib/test/test_structmembers.py (working copy) @@ -6,7 +6,7 @@ LLONG_MAX, LLONG_MIN, ULLONG_MAX import warnings, exceptions, unittest, sys -from test import test_support +from test import support ts=test_structmembersType(False, 1, 2, 3, 4, 5, 6, 7, 8, 9.99999, 10.1010101010) @@ -69,32 +69,32 @@ self.assertEqual(w.category, RuntimeWarning) def test_byte_max(self): - with test_support.catch_warning() as w: + with support.catch_warning() as w: ts.T_BYTE = CHAR_MAX+1 self.has_warned(w) def test_byte_min(self): - with test_support.catch_warning() as w: + with support.catch_warning() as w: ts.T_BYTE = CHAR_MIN-1 self.has_warned(w) def test_ubyte_max(self): - with test_support.catch_warning() as w: + with support.catch_warning() as w: ts.T_UBYTE = UCHAR_MAX+1 self.has_warned(w) def test_short_max(self): - with test_support.catch_warning() as w: + with support.catch_warning() as w: ts.T_SHORT = SHRT_MAX+1 self.has_warned(w) def test_short_min(self): - with test_support.catch_warning() as w: + with support.catch_warning() as w: ts.T_SHORT = SHRT_MIN-1 self.has_warned(w) def test_ushort_max(self): - with test_support.catch_warning() as w: + with support.catch_warning() as w: ts.T_USHORT = USHRT_MAX+1 self.has_warned(w) @@ -107,7 +107,7 @@ del globals()['__warningregistry__'] if hasattr(sys, '__warningregistry__'): del sys.__warningregistry__ - test_support.run_unittest(__name__) + support.run_unittest(__name__) if __name__ == "__main__": test_main(verbose=True) Index: Lib/test/test_sqlite.py =================================================================== --- Lib/test/test_sqlite.py (revision 62290) +++ Lib/test/test_sqlite.py (working copy) @@ -1,4 +1,4 @@ -from test.test_support import run_unittest, TestSkipped +from test.support import run_unittest, TestSkipped try: import _sqlite3 Index: Lib/test/test_posix.py =================================================================== --- Lib/test/test_posix.py (revision 62290) +++ Lib/test/test_posix.py (working copy) @@ -1,11 +1,11 @@ "Test posix functions" -from test import test_support +from test import support try: import posix except ImportError: - raise test_support.TestSkipped, "posix is not available" + raise support.TestSkipped, "posix is not available" import time import os @@ -19,11 +19,11 @@ def setUp(self): # create empty file - fp = open(test_support.TESTFN, 'w+') + fp = open(support.TESTFN, 'w+') fp.close() def tearDown(self): - os.unlink(test_support.TESTFN) + os.unlink(support.TESTFN) def testNoArgFunctions(self): # test posix functions which take no arguments and have @@ -46,7 +46,7 @@ def test_fstatvfs(self): if hasattr(posix, 'fstatvfs'): - fp = open(test_support.TESTFN) + fp = open(support.TESTFN) try: self.assert_(posix.fstatvfs(fp.fileno())) finally: @@ -54,7 +54,7 @@ def test_ftruncate(self): if hasattr(posix, 'ftruncate'): - fp = open(test_support.TESTFN, 'w+') + fp = open(support.TESTFN, 'w+') try: # we need to have some data to truncate fp.write('test') @@ -65,7 +65,7 @@ def test_dup(self): if hasattr(posix, 'dup'): - fp = open(test_support.TESTFN) + fp = open(support.TESTFN) try: fd = posix.dup(fp.fileno()) self.assert_(isinstance(fd, int)) @@ -80,8 +80,8 @@ def test_dup2(self): if hasattr(posix, 'dup2'): - fp1 = open(test_support.TESTFN) - fp2 = open(test_support.TESTFN) + fp1 = open(support.TESTFN) + fp2 = open(support.TESTFN) try: posix.dup2(fp1.fileno(), fp2.fileno()) finally: @@ -89,7 +89,7 @@ fp2.close() def fdopen_helper(self, *args): - fd = os.open(test_support.TESTFN, os.O_RDONLY) + fd = os.open(support.TESTFN, os.O_RDONLY) fp2 = posix.fdopen(fd, *args) fp2.close() @@ -101,38 +101,38 @@ def test_osexlock(self): if hasattr(posix, "O_EXLOCK"): - fd = os.open(test_support.TESTFN, + fd = os.open(support.TESTFN, os.O_WRONLY|os.O_EXLOCK|os.O_CREAT) - self.assertRaises(OSError, os.open, test_support.TESTFN, + self.assertRaises(OSError, os.open, support.TESTFN, os.O_WRONLY|os.O_EXLOCK|os.O_NONBLOCK) os.close(fd) if hasattr(posix, "O_SHLOCK"): - fd = os.open(test_support.TESTFN, + fd = os.open(support.TESTFN, os.O_WRONLY|os.O_SHLOCK|os.O_CREAT) - self.assertRaises(OSError, os.open, test_support.TESTFN, + self.assertRaises(OSError, os.open, support.TESTFN, os.O_WRONLY|os.O_EXLOCK|os.O_NONBLOCK) os.close(fd) def test_osshlock(self): if hasattr(posix, "O_SHLOCK"): - fd1 = os.open(test_support.TESTFN, + fd1 = os.open(support.TESTFN, os.O_WRONLY|os.O_SHLOCK|os.O_CREAT) - fd2 = os.open(test_support.TESTFN, + fd2 = os.open(support.TESTFN, os.O_WRONLY|os.O_SHLOCK|os.O_CREAT) os.close(fd2) os.close(fd1) if hasattr(posix, "O_EXLOCK"): - fd = os.open(test_support.TESTFN, + fd = os.open(support.TESTFN, os.O_WRONLY|os.O_SHLOCK|os.O_CREAT) - self.assertRaises(OSError, os.open, test_support.TESTFN, + self.assertRaises(OSError, os.open, support.TESTFN, os.O_RDONLY|os.O_EXLOCK|os.O_NONBLOCK) os.close(fd) def test_fstat(self): if hasattr(posix, 'fstat'): - fp = open(test_support.TESTFN) + fp = open(support.TESTFN) try: self.assert_(posix.fstat(fp.fileno())) finally: @@ -140,16 +140,16 @@ def test_stat(self): if hasattr(posix, 'stat'): - self.assert_(posix.stat(test_support.TESTFN)) + self.assert_(posix.stat(support.TESTFN)) if hasattr(posix, 'chown'): def test_chown(self): # raise an OSError if the file does not exist - os.unlink(test_support.TESTFN) - self.assertRaises(OSError, posix.chown, test_support.TESTFN, -1, -1) + os.unlink(support.TESTFN) + self.assertRaises(OSError, posix.chown, support.TESTFN, -1, -1) # re-create the file - open(test_support.TESTFN, 'w').close() + open(support.TESTFN, 'w').close() if os.getuid() == 0: try: # Many linux distros have a nfsnobody user as MAX_UID-2 @@ -158,29 +158,29 @@ # This part of the test only runs when run as root. # Only scary people run their tests as root. ent = pwd.getpwnam('nfsnobody') - posix.chown(test_support.TESTFN, ent.pw_uid, ent.pw_gid) + posix.chown(support.TESTFN, ent.pw_uid, ent.pw_gid) except KeyError: pass else: # non-root cannot chown to root, raises OSError self.assertRaises(OSError, posix.chown, - test_support.TESTFN, 0, 0) + support.TESTFN, 0, 0) # test a successful chown call - posix.chown(test_support.TESTFN, os.getuid(), os.getgid()) + posix.chown(support.TESTFN, os.getuid(), os.getgid()) def test_chdir(self): if hasattr(posix, 'chdir'): posix.chdir(os.curdir) - self.assertRaises(OSError, posix.chdir, test_support.TESTFN) + self.assertRaises(OSError, posix.chdir, support.TESTFN) def test_lsdir(self): if hasattr(posix, 'lsdir'): - self.assert_(test_support.TESTFN in posix.lsdir(os.curdir)) + self.assert_(support.TESTFN in posix.lsdir(os.curdir)) def test_access(self): if hasattr(posix, 'access'): - self.assert_(posix.access(test_support.TESTFN, os.R_OK)) + self.assert_(posix.access(support.TESTFN, os.R_OK)) def test_umask(self): if hasattr(posix, 'umask'): @@ -212,27 +212,27 @@ def test_utime(self): if hasattr(posix, 'utime'): now = time.time() - posix.utime(test_support.TESTFN, None) - self.assertRaises(TypeError, posix.utime, test_support.TESTFN, (None, None)) - self.assertRaises(TypeError, posix.utime, test_support.TESTFN, (now, None)) - self.assertRaises(TypeError, posix.utime, test_support.TESTFN, (None, now)) - posix.utime(test_support.TESTFN, (int(now), int(now))) - posix.utime(test_support.TESTFN, (now, now)) + posix.utime(support.TESTFN, None) + self.assertRaises(TypeError, posix.utime, support.TESTFN, (None, None)) + self.assertRaises(TypeError, posix.utime, support.TESTFN, (now, None)) + self.assertRaises(TypeError, posix.utime, support.TESTFN, (None, now)) + posix.utime(support.TESTFN, (int(now), int(now))) + posix.utime(support.TESTFN, (now, now)) def test_chflags(self): if hasattr(posix, 'chflags'): - st = os.stat(test_support.TESTFN) + st = os.stat(support.TESTFN) if hasattr(st, 'st_flags'): - posix.chflags(test_support.TESTFN, st.st_flags) + posix.chflags(support.TESTFN, st.st_flags) def test_lchflags(self): if hasattr(posix, 'lchflags'): - st = os.stat(test_support.TESTFN) + st = os.stat(support.TESTFN) if hasattr(st, 'st_flags'): - posix.lchflags(test_support.TESTFN, st.st_flags) + posix.lchflags(support.TESTFN, st.st_flags) def test_main(): - test_support.run_unittest(PosixTester) + support.run_unittest(PosixTester) if __name__ == '__main__': test_main() Index: Lib/test/test_curses.py =================================================================== --- Lib/test/test_curses.py (revision 62290) +++ Lib/test/test_curses.py (working copy) @@ -16,7 +16,7 @@ # 'curses' resource be given on the regrtest command line using the -u # option. If not available, nothing after this line will be executed. -from test.test_support import requires, TestSkipped +from test.support import requires, TestSkipped requires('curses') # XXX: if newterm was supported we could use it instead of initscr and not exit Index: Lib/test/test___all__.py =================================================================== --- Lib/test/test___all__.py (revision 62290) +++ Lib/test/test___all__.py (working copy) @@ -1,5 +1,5 @@ import unittest -from test.test_support import run_unittest +from test.support import run_unittest import sys import warnings Index: Lib/test/test_fcntl.py =================================================================== --- Lib/test/test_fcntl.py (revision 62290) +++ Lib/test/test_fcntl.py (working copy) @@ -8,7 +8,7 @@ import struct import sys import unittest -from test.test_support import verbose, TESTFN, unlink, run_unittest +from test.support import verbose, TESTFN, unlink, run_unittest # TODO - Write tests for flock() and lockf(). Index: Lib/test/test_binop.py =================================================================== --- Lib/test/test_binop.py (revision 62290) +++ Lib/test/test_binop.py (working copy) @@ -1,7 +1,7 @@ """Tests for binary operators on subtypes of built-in types.""" import unittest -from test import test_support +from test import support def gcd(a, b): """Greatest common divisor using Euclid's algorithm.""" @@ -321,7 +321,7 @@ """ def test_main(): - test_support.run_unittest(RatTestCase) + support.run_unittest(RatTestCase) if __name__ == "__main__": Index: Lib/test/test_cpickle.py =================================================================== --- Lib/test/test_cpickle.py (revision 62290) +++ Lib/test/test_cpickle.py (working copy) @@ -1,7 +1,7 @@ import cPickle from cStringIO import StringIO from test.pickletester import AbstractPickleTests, AbstractPickleModuleTests -from test import test_support +from test import support class cPickleTests(AbstractPickleTests, AbstractPickleModuleTests): @@ -91,7 +91,7 @@ self.assertEqual(a, b) def test_main(): - test_support.run_unittest( + support.run_unittest( cPickleTests, cPicklePicklerTests, cPickleListPicklerTests, Index: Lib/test/test_copy.py =================================================================== --- Lib/test/test_copy.py (revision 62290) +++ Lib/test/test_copy.py (working copy) @@ -4,7 +4,7 @@ import copy_reg import unittest -from test import test_support +from test import support class TestCopy(unittest.TestCase): @@ -50,7 +50,7 @@ def __reduce_ex__(self, proto): return "" def __reduce__(self): - raise test_support.TestFailed, "shouldn't call this" + raise support.TestFailed, "shouldn't call this" x = C() y = copy.copy(x) self.assert_(y is x) @@ -223,7 +223,7 @@ def __reduce_ex__(self, proto): return "" def __reduce__(self): - raise test_support.TestFailed, "shouldn't call this" + raise support.TestFailed, "shouldn't call this" x = C() y = copy.deepcopy(x) self.assert_(y is x) @@ -584,7 +584,7 @@ def global_foo(x, y): return x+y def test_main(): - test_support.run_unittest(TestCopy) + support.run_unittest(TestCopy) if __name__ == "__main__": test_main() Index: Lib/test/test_modulefinder.py =================================================================== --- Lib/test/test_modulefinder.py (revision 62290) +++ Lib/test/test_modulefinder.py (working copy) @@ -4,7 +4,7 @@ import distutils.dir_util import tempfile -from test import test_support +from test import support try: set except NameError: from sets import Set as set @@ -258,7 +258,7 @@ def test_main(): distutils.log.set_threshold(distutils.log.WARN) - test_support.run_unittest(ModuleFinderTest) + support.run_unittest(ModuleFinderTest) if __name__ == "__main__": unittest.main() Index: Lib/test/test_select.py =================================================================== --- Lib/test/test_select.py (revision 62290) +++ Lib/test/test_select.py (working copy) @@ -1,4 +1,4 @@ -from test import test_support +from test import support import unittest import select import os @@ -21,23 +21,23 @@ def test_select(self): if sys.platform[:3] in ('win', 'mac', 'os2', 'riscos'): - if test_support.verbose: + if support.verbose: print "Can't test select easily on", sys.platform return cmd = 'for i in 0 1 2 3 4 5 6 7 8 9; do echo testing...; sleep 1; done' p = os.popen(cmd, 'r') for tout in (0, 1, 2, 4, 8, 16) + (None,)*10: - if test_support.verbose: + if support.verbose: print 'timeout =', tout rfd, wfd, xfd = select.select([p], [], [], tout) if (rfd, wfd, xfd) == ([], [], []): continue if (rfd, wfd, xfd) == ([p], [], []): line = p.readline() - if test_support.verbose: + if support.verbose: print repr(line) if not line: - if test_support.verbose: + if support.verbose: print 'EOF' break continue @@ -46,8 +46,8 @@ def test_main(): - test_support.run_unittest(SelectTestCase) - test_support.reap_children() + support.run_unittest(SelectTestCase) + support.reap_children() if __name__ == "__main__": test_main() Index: Lib/test/test_threading_local.py =================================================================== --- Lib/test/test_threading_local.py (revision 62290) +++ Lib/test/test_threading_local.py (working copy) @@ -1,6 +1,6 @@ import unittest from doctest import DocTestSuite -from test import test_support +from test import support import threading import weakref import gc @@ -62,7 +62,7 @@ setUp=setUp, tearDown=tearDown) ) - test_support.run_unittest(suite) + support.run_unittest(suite) if __name__ == '__main__': test_main() Index: Lib/test/test_hash.py =================================================================== --- Lib/test/test_hash.py (revision 62290) +++ Lib/test/test_hash.py (working copy) @@ -3,7 +3,7 @@ # import unittest -from test import test_support +from test import support class HashEqualityTestCase(unittest.TestCase): @@ -40,7 +40,7 @@ def test_main(): - test_support.run_unittest(HashEqualityTestCase) + support.run_unittest(HashEqualityTestCase) if __name__ == "__main__": Index: Lib/test/test_richcmp.py =================================================================== --- Lib/test/test_richcmp.py (revision 62290) +++ Lib/test/test_richcmp.py (working copy) @@ -1,7 +1,7 @@ # Tests for rich comparisons import unittest -from test import test_support +from test import support import operator @@ -29,7 +29,7 @@ return self.x >= other def __cmp__(self, other): - raise test_support.TestFailed, "Number.__cmp__() should not be called" + raise support.TestFailed, "Number.__cmp__() should not be called" def __repr__(self): return "Number(%r)" % (self.x, ) @@ -55,7 +55,7 @@ raise TypeError, "Vectors cannot be used in Boolean contexts" def __cmp__(self, other): - raise test_support.TestFailed, "Vector.__cmp__() should not be called" + raise support.TestFailed, "Vector.__cmp__() should not be called" def __repr__(self): return "Vector(%r)" % (self.data, ) @@ -387,11 +387,11 @@ self.assertEquals(str(e), "unhashable type: 'DumbEqualityWithoutHash'") else: - raise test_support.TestFailed("Should not be here") + raise support.TestFailed("Should not be here") def test_main(): - test_support.run_unittest(VectorTest, NumberTest, MiscTest, DictTest, ListTest, HashableTest) + support.run_unittest(VectorTest, NumberTest, MiscTest, DictTest, ListTest, HashableTest) if __name__ == "__main__": test_main() Index: Lib/test/test_grp.py =================================================================== --- Lib/test/test_grp.py (revision 62290) +++ Lib/test/test_grp.py (working copy) @@ -2,7 +2,7 @@ import grp import unittest -from test import test_support +from test import support class GroupDatabaseTestCase(unittest.TestCase): @@ -86,7 +86,7 @@ self.assertRaises(KeyError, grp.getgrgid, fakegid) def test_main(): - test_support.run_unittest(GroupDatabaseTestCase) + support.run_unittest(GroupDatabaseTestCase) if __name__ == "__main__": test_main() Index: Lib/test/test_urllib.py =================================================================== --- Lib/test/test_urllib.py (revision 62290) +++ Lib/test/test_urllib.py (working copy) @@ -3,7 +3,7 @@ import urllib import httplib import unittest -from test import test_support +from test import support import os import mimetools import tempfile @@ -27,18 +27,18 @@ def setUp(self): """Setup of a temp file to use for testing""" self.text = "test_urllib: %s\n" % self.__class__.__name__ - FILE = file(test_support.TESTFN, 'wb') + FILE = file(support.TESTFN, 'wb') try: FILE.write(self.text) finally: FILE.close() - self.pathname = test_support.TESTFN + self.pathname = support.TESTFN self.returned_obj = urllib.urlopen("file:%s" % self.pathname) def tearDown(self): """Shut down the open object""" self.returned_obj.close() - os.remove(test_support.TESTFN) + os.remove(support.TESTFN) def test_interface(self): # Make sure object returned by urlopen() has the specified methods @@ -163,10 +163,10 @@ self.tempFiles = [] # Create a temporary file. - self.registerFileForCleanUp(test_support.TESTFN) + self.registerFileForCleanUp(support.TESTFN) self.text = 'testing urllib.urlretrieve' try: - FILE = file(test_support.TESTFN, 'wb') + FILE = file(support.TESTFN, 'wb') FILE.write(self.text) FILE.close() finally: @@ -204,18 +204,18 @@ def test_basic(self): # Make sure that a local file just gets its own location returned and # a headers value is returned. - result = urllib.urlretrieve("file:%s" % test_support.TESTFN) - self.assertEqual(result[0], test_support.TESTFN) + result = urllib.urlretrieve("file:%s" % support.TESTFN) + self.assertEqual(result[0], support.TESTFN) self.assert_(isinstance(result[1], mimetools.Message), "did not get a mimetools.Message instance as second " "returned value") def test_copy(self): # Test that setting the filename argument works. - second_temp = "%s.2" % test_support.TESTFN + second_temp = "%s.2" % support.TESTFN self.registerFileForCleanUp(second_temp) result = urllib.urlretrieve(self.constructLocalFileUrl( - test_support.TESTFN), second_temp) + support.TESTFN), second_temp) self.assertEqual(second_temp, result[0]) self.assert_(os.path.exists(second_temp), "copy of the file was not " "made") @@ -236,9 +236,9 @@ self.assert_(isinstance(total_size, int)) self.assertEqual(count, count_holder[0]) count_holder[0] = count_holder[0] + 1 - second_temp = "%s.2" % test_support.TESTFN + second_temp = "%s.2" % support.TESTFN self.registerFileForCleanUp(second_temp) - urllib.urlretrieve(self.constructLocalFileUrl(test_support.TESTFN), + urllib.urlretrieve(self.constructLocalFileUrl(support.TESTFN), second_temp, hooktester) def test_reporthook_0_bytes(self): @@ -248,7 +248,7 @@ _report.append((count, block_size, total_size)) srcFileName = self.createNewTempFile() urllib.urlretrieve(self.constructLocalFileUrl(srcFileName), - test_support.TESTFN, hooktester) + support.TESTFN, hooktester) self.assertEqual(len(report), 1) self.assertEqual(report[0][2], 0) @@ -262,7 +262,7 @@ _report.append((count, block_size, total_size)) srcFileName = self.createNewTempFile("x" * 5) urllib.urlretrieve(self.constructLocalFileUrl(srcFileName), - test_support.TESTFN, hooktester) + support.TESTFN, hooktester) self.assertEqual(len(report), 2) self.assertEqual(report[0][1], 8192) self.assertEqual(report[0][2], 5) @@ -276,7 +276,7 @@ _report.append((count, block_size, total_size)) srcFileName = self.createNewTempFile("x" * 8193) urllib.urlretrieve(self.constructLocalFileUrl(srcFileName), - test_support.TESTFN, hooktester) + support.TESTFN, hooktester) self.assertEqual(len(report), 3) self.assertEqual(report[0][1], 8192) self.assertEqual(report[0][2], 8193) @@ -632,7 +632,7 @@ def test_main(): - test_support.run_unittest( + support.run_unittest( urlopen_FileTests, urlopen_HttpTests, urlretrieve_FileTests, Index: Lib/test/test_mailbox.py =================================================================== --- Lib/test/test_mailbox.py (revision 62290) +++ Lib/test/test_mailbox.py (working copy) @@ -8,7 +8,7 @@ import rfc822 import re import StringIO -from test import test_support +from test import support import unittest import mailbox import glob @@ -53,7 +53,7 @@ _template = 'From: foo\n\n%s' def setUp(self): - self._path = test_support.TESTFN + self._path = support.TESTFN self._delete_recursively(self._path) self._box = self._factory(self._path) @@ -722,7 +722,7 @@ self._box.close() self._delete_recursively(self._path) for lock_remnant in glob.glob(self._path + '.*'): - test_support.unlink(lock_remnant) + support.unlink(lock_remnant) def test_add_from_string(self): # Add a string starting with 'From ' to the mailbox @@ -943,7 +943,7 @@ self._box.close() self._delete_recursively(self._path) for lock_remnant in glob.glob(self._path + '.*'): - test_support.unlink(lock_remnant) + support.unlink(lock_remnant) def test_labels(self): # Get labels from the mailbox @@ -969,7 +969,7 @@ _factory = mailbox.Message # Overridden by subclasses to reuse tests def setUp(self): - self._path = test_support.TESTFN + self._path = support.TESTFN def tearDown(self): self._delete_recursively(self._path) @@ -1581,7 +1581,7 @@ class TestProxyFile(TestProxyFileBase): def setUp(self): - self._path = test_support.TESTFN + self._path = support.TESTFN self._file = open(self._path, 'wb+') def tearDown(self): @@ -1630,7 +1630,7 @@ class TestPartialFile(TestProxyFileBase): def setUp(self): - self._path = test_support.TESTFN + self._path = support.TESTFN self._file = open(self._path, 'wb+') def tearDown(self): @@ -1693,7 +1693,7 @@ def setUp(self): # create a new maildir mailbox to work with: - self._dir = test_support.TESTFN + self._dir = support.TESTFN os.mkdir(self._dir) os.mkdir(os.path.join(self._dir, "cur")) os.mkdir(os.path.join(self._dir, "tmp")) @@ -1734,7 +1734,7 @@ """Test an empty maildir mailbox""" # Test for regression on bug #117490: # Make sure the boxes attribute actually gets set. - self.mbox = mailbox.Maildir(test_support.TESTFN) + self.mbox = mailbox.Maildir(support.TESTFN) #self.assert_(hasattr(self.mbox, "boxes")) #self.assert_(len(self.mbox.boxes) == 0) self.assert_(self.mbox.next() is None) @@ -1742,7 +1742,7 @@ def test_nonempty_maildir_cur(self): self.createMessage("cur") - self.mbox = mailbox.Maildir(test_support.TESTFN) + self.mbox = mailbox.Maildir(support.TESTFN) #self.assert_(len(self.mbox.boxes) == 1) self.assert_(self.mbox.next() is not None) self.assert_(self.mbox.next() is None) @@ -1750,7 +1750,7 @@ def test_nonempty_maildir_new(self): self.createMessage("new") - self.mbox = mailbox.Maildir(test_support.TESTFN) + self.mbox = mailbox.Maildir(support.TESTFN) #self.assert_(len(self.mbox.boxes) == 1) self.assert_(self.mbox.next() is not None) self.assert_(self.mbox.next() is None) @@ -1759,7 +1759,7 @@ def test_nonempty_maildir_both(self): self.createMessage("cur") self.createMessage("new") - self.mbox = mailbox.Maildir(test_support.TESTFN) + self.mbox = mailbox.Maildir(support.TESTFN) #self.assert_(len(self.mbox.boxes) == 2) self.assert_(self.mbox.next() is not None) self.assert_(self.mbox.next() is not None) @@ -1869,8 +1869,8 @@ TestMHMessage, TestBabylMessage, TestMMDFMessage, TestMessageConversion, TestProxyFile, TestPartialFile, MaildirTestCase) - test_support.run_unittest(*tests) - test_support.reap_children() + support.run_unittest(*tests) + support.reap_children() if __name__ == '__main__': Index: Lib/test/test_sax.py =================================================================== --- Lib/test/test_sax.py (revision 62290) +++ Lib/test/test_sax.py (working copy) @@ -13,7 +13,7 @@ from xml.sax.expatreader import create_parser from xml.sax.xmlreader import InputSource, AttributesImpl, AttributesNSImpl from cStringIO import StringIO -from test.test_support import findfile, run_unittest +from test.support import findfile, run_unittest import unittest import os Index: Lib/test/test_urlparse.py =================================================================== --- Lib/test/test_urlparse.py (revision 62290) +++ Lib/test/test_urlparse.py (working copy) @@ -1,6 +1,6 @@ #! /usr/bin/env python -from test import test_support +from test import support import unittest import urlparse @@ -322,7 +322,7 @@ ('http', 'example.com', '', '', 'blahblah=/foo', '')) def test_main(): - test_support.run_unittest(UrlParseTestCase) + support.run_unittest(UrlParseTestCase) if __name__ == "__main__": test_main() Index: Lib/test/test_bigmem.py =================================================================== --- Lib/test/test_bigmem.py (revision 62290) +++ Lib/test/test_bigmem.py (working copy) @@ -1,5 +1,5 @@ -from test import test_support -from test.test_support import bigmemtest, _1G, _2G +from test import support +from test.support import bigmemtest, _1G, _2G import unittest import operator @@ -958,9 +958,9 @@ self.assertEquals(l[-10:], [5] * 10) def test_main(): - test_support.run_unittest(StrTest, TupleTest, ListTest) + support.run_unittest(StrTest, TupleTest, ListTest) if __name__ == '__main__': if len(sys.argv) > 1: - test_support.set_memlimit(sys.argv[1]) + support.set_memlimit(sys.argv[1]) test_main() Index: Lib/test/test_codecencodings_jp.py =================================================================== --- Lib/test/test_codecencodings_jp.py (revision 62290) +++ Lib/test/test_codecencodings_jp.py (working copy) @@ -4,7 +4,7 @@ # Codec encoding tests for Japanese encodings. # -from test import test_support +from test import support from test import test_multibytecodec_support import unittest @@ -99,7 +99,7 @@ ) def test_main(): - test_support.run_unittest(__name__) + support.run_unittest(__name__) if __name__ == "__main__": test_main() Index: Lib/test/test_coercion.py =================================================================== --- Lib/test/test_coercion.py (revision 62290) +++ Lib/test/test_coercion.py (working copy) @@ -1,7 +1,7 @@ import copy import warnings import unittest -from test.test_support import run_unittest, TestFailed +from test.support import run_unittest, TestFailed # Fake a number that implements numeric methods through __coerce__ class CoerceNumber: Index: Lib/test/test_zipfile.py =================================================================== --- Lib/test/test_zipfile.py (revision 62290) +++ Lib/test/test_zipfile.py (working copy) @@ -10,8 +10,8 @@ from tempfile import TemporaryFile from random import randint, random -import test.test_support as support -from test.test_support import TESTFN, run_unittest +import test.support as support +from test.support import TESTFN, run_unittest TESTFN2 = TESTFN + "2" FIXEDTEST_SIZE = 1000 Index: Lib/test/test_class.py =================================================================== --- Lib/test/test_class.py (revision 62290) +++ Lib/test/test_class.py (working copy) @@ -2,7 +2,7 @@ import unittest -from test import test_support +from test import support testmeths = [ @@ -616,7 +616,7 @@ hash(a.f) def test_main(): - test_support.run_unittest(ClassTests) + support.run_unittest(ClassTests) if __name__=='__main__': test_main() Index: Lib/test/test_cookie.py =================================================================== --- Lib/test/test_cookie.py (revision 62290) +++ Lib/test/test_cookie.py (working copy) @@ -1,6 +1,6 @@ # Simple test suite for Cookie.py -from test.test_support import run_unittest, run_doctest +from test.support import run_unittest, run_doctest import unittest import Cookie Index: Lib/test/test_urllib2.py =================================================================== --- Lib/test/test_urllib2.py (revision 62290) +++ Lib/test/test_urllib2.py (working copy) @@ -1,5 +1,5 @@ import unittest -from test import test_support +from test import support import os import StringIO @@ -593,7 +593,7 @@ h = urllib2.FileHandler() o = h.parent = MockOpener() - TESTFN = test_support.TESTFN + TESTFN = support.TESTFN urlpath = sanepathname2url(os.path.abspath(TESTFN)) towrite = "hello, world\n" urls = [ @@ -1073,13 +1073,13 @@ def test_main(verbose=None): from test import test_urllib2 - test_support.run_doctest(test_urllib2, verbose) - test_support.run_doctest(urllib2, verbose) + support.run_doctest(test_urllib2, verbose) + support.run_doctest(urllib2, verbose) tests = (TrivialTests, OpenerDirectorTests, HandlerTests, MiscTests) - test_support.run_unittest(*tests) + support.run_unittest(*tests) if __name__ == "__main__": test_main(verbose=True) Index: Lib/test/test_pty.py =================================================================== --- Lib/test/test_pty.py (revision 62290) +++ Lib/test/test_pty.py (working copy) @@ -4,7 +4,7 @@ import os import sys import signal -from test.test_support import verbose, TestSkipped, run_unittest +from test.support import verbose, TestSkipped, run_unittest import unittest TEST_STRING_1 = "I wish to buy a fish license.\n" Index: Lib/test/test_filecmp.py =================================================================== --- Lib/test/test_filecmp.py (revision 62290) +++ Lib/test/test_filecmp.py (working copy) @@ -1,13 +1,13 @@ import os, filecmp, shutil, tempfile, shutil import unittest -from test import test_support +from test import support class FileCompareTestCase(unittest.TestCase): def setUp(self): - self.name = test_support.TESTFN - self.name_same = test_support.TESTFN + '-same' - self.name_diff = test_support.TESTFN + '-diff' + self.name = support.TESTFN + self.name_same = support.TESTFN + '-same' + self.name_diff = support.TESTFN + '-diff' data = 'Contents of file go here.\n' for name in [self.name, self.name_same, self.name_diff]: output = open(name, 'w') @@ -128,7 +128,7 @@ def test_main(): - test_support.run_unittest(FileCompareTestCase, DirCompareTestCase) + support.run_unittest(FileCompareTestCase, DirCompareTestCase) if __name__ == "__main__": test_main() Index: Lib/test/test_augassign.py =================================================================== --- Lib/test/test_augassign.py (revision 62290) +++ Lib/test/test_augassign.py (working copy) @@ -1,6 +1,6 @@ # Augmented assignment test. -from test.test_support import run_unittest +from test.support import run_unittest import unittest Index: Lib/test/test_userdict.py =================================================================== --- Lib/test/test_userdict.py (revision 62290) +++ Lib/test/test_userdict.py (working copy) @@ -1,6 +1,6 @@ # Check every path through every method of UserDict -from test import test_support, mapping_tests +from test import support, mapping_tests import UserDict d0 = {} @@ -340,7 +340,7 @@ self.assertEqual(s, t) def test_main(): - test_support.run_unittest( + support.run_unittest( UserDictTest, UserDictMixinTest ) Index: Lib/test/test_xrange.py =================================================================== --- Lib/test/test_xrange.py (revision 62290) +++ Lib/test/test_xrange.py (working copy) @@ -1,6 +1,6 @@ # Python test set -- built-in functions -import test.test_support, unittest +import test.support, unittest import sys import warnings @@ -58,7 +58,7 @@ self.assertRaises(OverflowError, xrange, -sys.maxint-1, sys.maxint, 2) def test_main(): - test.test_support.run_unittest(XrangeTest) + test.support.run_unittest(XrangeTest) if __name__ == "__main__": test_main() Index: Lib/test/test_pickletools.py =================================================================== --- Lib/test/test_pickletools.py (revision 62290) +++ Lib/test/test_pickletools.py (working copy) @@ -1,6 +1,6 @@ import pickle import pickletools -from test import test_support +from test import support from test.pickletester import AbstractPickleTests from test.pickletester import AbstractPickleModuleTests @@ -16,8 +16,8 @@ error = KeyError def test_main(): - test_support.run_unittest(OptimizedPickleTests) - test_support.run_doctest(pickletools) + support.run_unittest(OptimizedPickleTests) + support.run_doctest(pickletools) if __name__ == "__main__": Index: Lib/test/test_startfile.py =================================================================== --- Lib/test/test_startfile.py (revision 62290) +++ Lib/test/test_startfile.py (working copy) @@ -8,7 +8,7 @@ # call succeeded, but also the the script actually has run. import unittest -from test import test_support +from test import support # use this form so that the test is skipped when startfile is not available: from os import startfile, path @@ -31,7 +31,7 @@ startfile(unicode(empty, "mbcs"), "open") def test_main(): - test_support.run_unittest(TestCase) + support.run_unittest(TestCase) if __name__=="__main__": test_main() Index: Lib/test/test_trace.py =================================================================== --- Lib/test/test_trace.py (revision 62290) +++ Lib/test/test_trace.py (working copy) @@ -1,6 +1,6 @@ # Testing the line trace facility. -from test import test_support +from test import support import unittest import sys import difflib @@ -729,7 +729,7 @@ no_jump_without_trace_function() def test_main(): - test_support.run_unittest( + support.run_unittest( TraceTestCase, RaisingTraceFuncTestCase, JumpTestCase Index: Lib/test/test_dircache.py =================================================================== --- Lib/test/test_dircache.py (revision 62290) +++ Lib/test/test_dircache.py (working copy) @@ -4,7 +4,7 @@ """ import unittest -from test.test_support import run_unittest, TESTFN +from test.support import run_unittest, TESTFN import dircache, os, time, sys, tempfile Index: Lib/test/test_threading.py =================================================================== --- Lib/test/test_threading.py (revision 62290) +++ Lib/test/test_threading.py (working copy) @@ -1,7 +1,7 @@ # Very rudimentary test of threading module -import test.test_support -from test.test_support import verbose +import test.support +from test.support import verbose import random import sys import threading @@ -357,7 +357,7 @@ def test_main(): - test.test_support.run_unittest(ThreadTests, + test.support.run_unittest(ThreadTests, ThreadingExceptionTests) if __name__ == "__main__": Index: Lib/test/test_userstring.py =================================================================== --- Lib/test/test_userstring.py (revision 62290) +++ Lib/test/test_userstring.py (working copy) @@ -3,7 +3,7 @@ # UserString instances should behave similar to builtin string objects. import string -from test import test_support, string_tests +from test import support, string_tests from UserString import UserString, MutableString @@ -135,7 +135,7 @@ self.assertEqual(s, "") def test_main(): - test_support.run_unittest(UserStringTest, MutableStringTest) + support.run_unittest(UserStringTest, MutableStringTest) if __name__ == "__main__": test_main() Index: Lib/test/test_builtin.py =================================================================== --- Lib/test/test_builtin.py (revision 62290) +++ Lib/test/test_builtin.py (working copy) @@ -1,7 +1,7 @@ # Python test set -- built-in functions -import test.test_support, unittest -from test.test_support import fcmp, have_unicode, TESTFN, unlink, \ +import test.support, unittest +from test.support import fcmp, have_unicode, TESTFN, unlink, \ run_unittest, run_with_locale from operator import neg Index: Lib/test/test_copy_reg.py =================================================================== --- Lib/test/test_copy_reg.py (revision 62290) +++ Lib/test/test_copy_reg.py (working copy) @@ -1,7 +1,7 @@ import copy_reg import unittest -from test import test_support +from test import support from test.pickletester import ExtensionSaver class C: @@ -114,7 +114,7 @@ def test_main(): - test_support.run_unittest(CopyRegTestCase) + support.run_unittest(CopyRegTestCase) if __name__ == "__main__": Index: Lib/test/test_multibytecodec_support.py =================================================================== --- Lib/test/test_multibytecodec_support.py (revision 62290) +++ Lib/test/test_multibytecodec_support.py (working copy) @@ -6,7 +6,7 @@ import sys, codecs import unittest, re -from test import test_support +from test import support from StringIO import StringIO class TestBase: @@ -269,7 +269,7 @@ self.open_mapping_file() # test it to report the error early def open_mapping_file(self): - return test_support.open_urlresource(self.mapfileurl) + return support.open_urlresource(self.mapfileurl) def test_mapping_file(self): if self.mapfileurl.endswith('.xml'): Index: Lib/test/test_funcattrs.py =================================================================== --- Lib/test/test_funcattrs.py (revision 62290) +++ Lib/test/test_funcattrs.py (working copy) @@ -1,4 +1,4 @@ -from test import test_support +from test import support import types import unittest @@ -274,7 +274,7 @@ self.assertEqual(self.b.func_doc, None) def test_main(): - test_support.run_unittest(FunctionPropertiesTest, ImplicitReferencesTest, + support.run_unittest(FunctionPropertiesTest, ImplicitReferencesTest, ArbitraryFunctionAttrTest, FunctionDictsTest, FunctionDocstringTest) Index: Lib/test/test_userlist.py =================================================================== --- Lib/test/test_userlist.py (revision 62290) +++ Lib/test/test_userlist.py (working copy) @@ -1,7 +1,7 @@ # Check every path through every method of UserList from UserList import UserList -from test import test_support, list_tests +from test import support, list_tests class UserListTest(list_tests.CommonTest): type2test = UserList @@ -53,7 +53,7 @@ self.assertEqual(iter(T((1,2))).next(), "0!!!") def test_main(): - test_support.run_unittest(UserListTest) + support.run_unittest(UserListTest) if __name__ == "__main__": test_main() Index: Lib/test/test_call.py =================================================================== --- Lib/test/test_call.py (revision 62290) +++ Lib/test/test_call.py (working copy) @@ -1,5 +1,5 @@ import unittest -from test import test_support +from test import support # The test cases here cover several paths through the function calling # code. They depend on the METH_XXX flag that is used to define a C @@ -124,7 +124,7 @@ def test_main(): - test_support.run_unittest(CFunctionCalls) + support.run_unittest(CFunctionCalls) if __name__ == "__main__": Index: Lib/test/test_support.py =================================================================== --- Lib/test/test_support.py (revision 62290) +++ Lib/test/test_support.py (working copy) @@ -1,718 +0,0 @@ -"""Supporting definitions for the Python regression tests.""" - -if __name__ != 'test.test_support': - raise ImportError('test_support must be imported from the test package') - -import contextlib -import errno -import socket -import sys -import os -import os.path -import shutil -import warnings -import unittest - -class Error(Exception): - """Base class for regression test exceptions.""" - -class TestFailed(Error): - """Test failed.""" - -class TestSkipped(Error): - """Test skipped. - - This can be raised to indicate that a test was deliberatly - skipped, but not because a feature wasn't available. For - example, if some resource can't be used, such as the network - appears to be unavailable, this should be raised instead of - TestFailed. - """ - -class ResourceDenied(TestSkipped): - """Test skipped because it requested a disallowed resource. - - This is raised when a test calls requires() for a resource that - has not be enabled. It is used to distinguish between expected - and unexpected skips. - """ - -verbose = 1 # Flag set to 0 by regrtest.py -use_resources = None # Flag set to [] by regrtest.py -max_memuse = 0 # Disable bigmem tests (they will still be run with - # small sizes, to make sure they work.) - -# _original_stdout is meant to hold stdout at the time regrtest began. -# This may be "the real" stdout, or IDLE's emulation of stdout, or whatever. -# The point is to have some flavor of stdout the user can actually see. -_original_stdout = None -def record_original_stdout(stdout): - global _original_stdout - _original_stdout = stdout - -def get_original_stdout(): - return _original_stdout or sys.stdout - -def unload(name): - try: - del sys.modules[name] - except KeyError: - pass - -def unlink(filename): - try: - os.unlink(filename) - except OSError: - pass - -def rmtree(path): - try: - shutil.rmtree(path) - except OSError, e: - # Unix returns ENOENT, Windows returns ESRCH. - if e.errno not in (errno.ENOENT, errno.ESRCH): - raise - -def forget(modname): - '''"Forget" a module was ever imported by removing it from sys.modules and - deleting any .pyc and .pyo files.''' - unload(modname) - for dirname in sys.path: - unlink(os.path.join(dirname, modname + os.extsep + 'pyc')) - # Deleting the .pyo file cannot be within the 'try' for the .pyc since - # the chance exists that there is no .pyc (and thus the 'try' statement - # is exited) but there is a .pyo file. - unlink(os.path.join(dirname, modname + os.extsep + 'pyo')) - -def is_resource_enabled(resource): - """Test whether a resource is enabled. Known resources are set by - regrtest.py.""" - return use_resources is not None and resource in use_resources - -def requires(resource, msg=None): - """Raise ResourceDenied if the specified resource is not available. - - If the caller's module is __main__ then automatically return True. The - possibility of False being returned occurs when regrtest.py is executing.""" - # see if the caller's module is __main__ - if so, treat as if - # the resource was set - if sys._getframe().f_back.f_globals.get("__name__") == "__main__": - return - if not is_resource_enabled(resource): - if msg is None: - msg = "Use of the `%s' resource not enabled" % resource - raise ResourceDenied(msg) - -HOST = 'localhost' - -def find_unused_port(family=socket.AF_INET, socktype=socket.SOCK_STREAM): - """Returns an unused port that should be suitable for binding. This is - achieved by creating a temporary socket with the same family and type as - the 'sock' parameter (default is AF_INET, SOCK_STREAM), and binding it to - the specified host address (defaults to 0.0.0.0) with the port set to 0, - eliciting an unused ephemeral port from the OS. The temporary socket is - then closed and deleted, and the ephemeral port is returned. - - Either this method or bind_port() should be used for any tests where a - server socket needs to be bound to a particular port for the duration of - the test. Which one to use depends on whether the calling code is creating - a python socket, or if an unused port needs to be provided in a constructor - or passed to an external program (i.e. the -accept argument to openssl's - s_server mode). Always prefer bind_port() over find_unused_port() where - possible. Hard coded ports should *NEVER* be used. As soon as a server - socket is bound to a hard coded port, the ability to run multiple instances - of the test simultaneously on the same host is compromised, which makes the - test a ticking time bomb in a buildbot environment. On Unix buildbots, this - may simply manifest as a failed test, which can be recovered from without - intervention in most cases, but on Windows, the entire python process can - completely and utterly wedge, requiring someone to log in to the buildbot - and manually kill the affected process. - - (This is easy to reproduce on Windows, unfortunately, and can be traced to - the SO_REUSEADDR socket option having different semantics on Windows versus - Unix/Linux. On Unix, you can't have two AF_INET SOCK_STREAM sockets bind, - listen and then accept connections on identical host/ports. An EADDRINUSE - socket.error will be raised at some point (depending on the platform and - the order bind and listen were called on each socket). - - However, on Windows, if SO_REUSEADDR is set on the sockets, no EADDRINUSE - will ever be raised when attempting to bind two identical host/ports. When - accept() is called on each socket, the second caller's process will steal - the port from the first caller, leaving them both in an awkwardly wedged - state where they'll no longer respond to any signals or graceful kills, and - must be forcibly killed via OpenProcess()/TerminateProcess(). - - The solution on Windows is to use the SO_EXCLUSIVEADDRUSE socket option - instead of SO_REUSEADDR, which effectively affords the same semantics as - SO_REUSEADDR on Unix. Given the propensity of Unix developers in the Open - Source world compared to Windows ones, this is a common mistake. A quick - look over OpenSSL's 0.9.8g source shows that they use SO_REUSEADDR when - openssl.exe is called with the 's_server' option, for example. See - http://bugs.python.org/issue2550 for more info. The following site also - has a very thorough description about the implications of both REUSEADDR - and EXCLUSIVEADDRUSE on Windows: - http://msdn2.microsoft.com/en-us/library/ms740621(VS.85).aspx) - - XXX: although this approach is a vast improvement on previous attempts to - elicit unused ports, it rests heavily on the assumption that the ephemeral - port returned to us by the OS won't immediately be dished back out to some - other process when we close and delete our temporary socket but before our - calling code has a chance to bind the returned port. We can deal with this - issue if/when we come across it.""" - tempsock = socket.socket(family, socktype) - port = bind_port(tempsock) - tempsock.close() - del tempsock - return port - -def bind_port(sock, host=HOST): - """Bind the socket to a free port and return the port number. Relies on - ephemeral ports in order to ensure we are using an unbound port. This is - important as many tests may be running simultaneously, especially in a - buildbot environment. This method raises an exception if the sock.family - is AF_INET and sock.type is SOCK_STREAM, *and* the socket has SO_REUSEADDR - or SO_REUSEPORT set on it. Tests should *never* set these socket options - for TCP/IP sockets. The only case for setting these options is testing - multicasting via multiple UDP sockets. - - Additionally, if the SO_EXCLUSIVEADDRUSE socket option is available (i.e. - on Windows), it will be set on the socket. This will prevent anyone else - from bind()'ing to our host/port for the duration of the test. - """ - if sock.family == socket.AF_INET and sock.type == socket.SOCK_STREAM: - if hasattr(socket, 'SO_REUSEADDR'): - if sock.getsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR) == 1: - raise TestFailed("tests should never set the SO_REUSEADDR " \ - "socket option on TCP/IP sockets!") - if hasattr(socket, 'SO_REUSEPORT'): - if sock.getsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT) == 1: - raise TestFailed("tests should never set the SO_REUSEPORT " \ - "socket option on TCP/IP sockets!") - if hasattr(socket, 'SO_EXCLUSIVEADDRUSE'): - sock.setsockopt(socket.SOL_SOCKET, socket.SO_EXCLUSIVEADDRUSE, 1) - - sock.bind((host, 0)) - port = sock.getsockname()[1] - return port - -FUZZ = 1e-6 - -def fcmp(x, y): # fuzzy comparison function - if type(x) == type(0.0) or type(y) == type(0.0): - try: - x, y = coerce(x, y) - fuzz = (abs(x) + abs(y)) * FUZZ - if abs(x-y) <= fuzz: - return 0 - except: - pass - elif type(x) == type(y) and type(x) in (type(()), type([])): - for i in range(min(len(x), len(y))): - outcome = fcmp(x[i], y[i]) - if outcome != 0: - return outcome - return cmp(len(x), len(y)) - return cmp(x, y) - -try: - unicode - have_unicode = True -except NameError: - have_unicode = False - -is_jython = sys.platform.startswith('java') - -# Filename used for testing -if os.name == 'java': - # Jython disallows @ in module names - TESTFN = '$test' -elif os.name == 'riscos': - TESTFN = 'testfile' -else: - TESTFN = '@test' - # Unicode name only used if TEST_FN_ENCODING exists for the platform. - if have_unicode: - # Assuming sys.getfilesystemencoding()!=sys.getdefaultencoding() - # TESTFN_UNICODE is a filename that can be encoded using the - # file system encoding, but *not* with the default (ascii) encoding - if isinstance('', unicode): - # python -U - # XXX perhaps unicode() should accept Unicode strings? - TESTFN_UNICODE = "@test-\xe0\xf2" - else: - # 2 latin characters. - TESTFN_UNICODE = unicode("@test-\xe0\xf2", "latin-1") - TESTFN_ENCODING = sys.getfilesystemencoding() - # TESTFN_UNICODE_UNENCODEABLE is a filename that should *not* be - # able to be encoded by *either* the default or filesystem encoding. - # This test really only makes sense on Windows NT platforms - # which have special Unicode support in posixmodule. - if (not hasattr(sys, "getwindowsversion") or - sys.getwindowsversion()[3] < 2): # 0=win32s or 1=9x/ME - TESTFN_UNICODE_UNENCODEABLE = None - else: - # Japanese characters (I think - from bug 846133) - TESTFN_UNICODE_UNENCODEABLE = eval('u"@test-\u5171\u6709\u3055\u308c\u308b"') - try: - # XXX - Note - should be using TESTFN_ENCODING here - but for - # Windows, "mbcs" currently always operates as if in - # errors=ignore' mode - hence we get '?' characters rather than - # the exception. 'Latin1' operates as we expect - ie, fails. - # See [ 850997 ] mbcs encoding ignores errors - TESTFN_UNICODE_UNENCODEABLE.encode("Latin1") - except UnicodeEncodeError: - pass - else: - print \ - 'WARNING: The filename %r CAN be encoded by the filesystem. ' \ - 'Unicode filename tests may not be effective' \ - % TESTFN_UNICODE_UNENCODEABLE - -# Make sure we can write to TESTFN, try in /tmp if we can't -fp = None -try: - fp = open(TESTFN, 'w+') -except IOError: - TMP_TESTFN = os.path.join('/tmp', TESTFN) - try: - fp = open(TMP_TESTFN, 'w+') - TESTFN = TMP_TESTFN - del TMP_TESTFN - except IOError: - print ('WARNING: tests will fail, unable to write to: %s or %s' % - (TESTFN, TMP_TESTFN)) -if fp is not None: - fp.close() - unlink(TESTFN) -del fp - -def findfile(file, here=__file__): - """Try to find a file on sys.path and the working directory. If it is not - found the argument passed to the function is returned (this does not - necessarily signal failure; could still be the legitimate path).""" - if os.path.isabs(file): - return file - path = sys.path - path = [os.path.dirname(here)] + path - for dn in path: - fn = os.path.join(dn, file) - if os.path.exists(fn): return fn - return file - -def verify(condition, reason='test failed'): - """Verify that condition is true. If not, raise TestFailed. - - The optional argument reason can be given to provide - a better error text. - """ - - if not condition: - raise TestFailed(reason) - -def vereq(a, b): - """Raise TestFailed if a == b is false. - - This is better than verify(a == b) because, in case of failure, the - error message incorporates repr(a) and repr(b) so you can see the - inputs. - - Note that "not (a == b)" isn't necessarily the same as "a != b"; the - former is tested. - """ - - if not (a == b): - raise TestFailed("%r == %r" % (a, b)) - -def sortdict(dict): - "Like repr(dict), but in sorted order." - items = dict.items() - items.sort() - reprpairs = ["%r: %r" % pair for pair in items] - withcommas = ", ".join(reprpairs) - return "{%s}" % withcommas - -def check_syntax_error(testcase, statement): - try: - compile(statement, '', 'exec') - except SyntaxError: - pass - else: - testcase.fail('Missing SyntaxError: "%s"' % statement) - -def open_urlresource(url): - import urllib, urlparse - - requires('urlfetch') - filename = urlparse.urlparse(url)[2].split('/')[-1] # '/': it's URL! - - for path in [os.path.curdir, os.path.pardir]: - fn = os.path.join(path, filename) - if os.path.exists(fn): - return open(fn) - - print >> get_original_stdout(), '\tfetching %s ...' % url - fn, _ = urllib.urlretrieve(url, filename) - return open(fn) - - -class WarningMessage(object): - "Holds the result of the latest showwarning() call" - def __init__(self): - self.message = None - self.category = None - self.filename = None - self.lineno = None - - def _showwarning(self, message, category, filename, lineno, file=None): - self.message = message - self.category = category - self.filename = filename - self.lineno = lineno - -@contextlib.contextmanager -def catch_warning(): - """ - Guard the warnings filter from being permanently changed and record the - data of the last warning that has been issued. - - Use like this: - - with catch_warning() as w: - warnings.warn("foo") - assert str(w.message) == "foo" - """ - warning = WarningMessage() - original_filters = warnings.filters[:] - original_showwarning = warnings.showwarning - warnings.showwarning = warning._showwarning - try: - yield warning - finally: - warnings.showwarning = original_showwarning - warnings.filters = original_filters - -class EnvironmentVarGuard(object): - - """Class to help protect the environment variable properly. Can be used as - a context manager.""" - - def __init__(self): - self._environ = os.environ - self._unset = set() - self._reset = dict() - - def set(self, envvar, value): - if envvar not in self._environ: - self._unset.add(envvar) - else: - self._reset[envvar] = self._environ[envvar] - self._environ[envvar] = value - - def unset(self, envvar): - if envvar in self._environ: - self._reset[envvar] = self._environ[envvar] - del self._environ[envvar] - - def __enter__(self): - return self - - def __exit__(self, *ignore_exc): - for envvar, value in self._reset.iteritems(): - self._environ[envvar] = value - for unset in self._unset: - del self._environ[unset] - -class TransientResource(object): - - """Raise ResourceDenied if an exception is raised while the context manager - is in effect that matches the specified exception and attributes.""" - - def __init__(self, exc, **kwargs): - self.exc = exc - self.attrs = kwargs - - def __enter__(self): - return self - - def __exit__(self, type_=None, value=None, traceback=None): - """If type_ is a subclass of self.exc and value has attributes matching - self.attrs, raise ResourceDenied. Otherwise let the exception - propagate (if any).""" - if type_ is not None and issubclass(self.exc, type_): - for attr, attr_value in self.attrs.iteritems(): - if not hasattr(value, attr): - break - if getattr(value, attr) != attr_value: - break - else: - raise ResourceDenied("an optional resource is not available") - - -def transient_internet(): - """Return a context manager that raises ResourceDenied when various issues - with the Internet connection manifest themselves as exceptions.""" - time_out = TransientResource(IOError, errno=errno.ETIMEDOUT) - socket_peer_reset = TransientResource(socket.error, errno=errno.ECONNRESET) - ioerror_peer_reset = TransientResource(IOError, errno=errno.ECONNRESET) - return contextlib.nested(time_out, socket_peer_reset, ioerror_peer_reset) - - -@contextlib.contextmanager -def captured_output(stream_name): - """Run the 'with' statement body using a StringIO object in place of a - specific attribute on the sys module. - Example use (with 'stream_name=stdout'):: - - with captured_stdout() as s: - print "hello" - assert s.getvalue() == "hello" - """ - import StringIO - orig_stdout = getattr(sys, stream_name) - setattr(sys, stream_name, StringIO.StringIO()) - yield getattr(sys, stream_name) - setattr(sys, stream_name, orig_stdout) - -def captured_stdout(): - return captured_output("stdout") - - -#======================================================================= -# Decorator for running a function in a different locale, correctly resetting -# it afterwards. - -def run_with_locale(catstr, *locales): - def decorator(func): - def inner(*args, **kwds): - try: - import locale - category = getattr(locale, catstr) - orig_locale = locale.setlocale(category) - except AttributeError: - # if the test author gives us an invalid category string - raise - except: - # cannot retrieve original locale, so do nothing - locale = orig_locale = None - else: - for loc in locales: - try: - locale.setlocale(category, loc) - break - except: - pass - - # now run the function, resetting the locale on exceptions - try: - return func(*args, **kwds) - finally: - if locale and orig_locale: - locale.setlocale(category, orig_locale) - inner.func_name = func.func_name - inner.__doc__ = func.__doc__ - return inner - return decorator - -#======================================================================= -# Big-memory-test support. Separate from 'resources' because memory use should be configurable. - -# Some handy shorthands. Note that these are used for byte-limits as well -# as size-limits, in the various bigmem tests -_1M = 1024*1024 -_1G = 1024 * _1M -_2G = 2 * _1G - -# Hack to get at the maximum value an internal index can take. -class _Dummy: - def __getslice__(self, i, j): - return j -MAX_Py_ssize_t = _Dummy()[:] - -def set_memlimit(limit): - import re - global max_memuse - sizes = { - 'k': 1024, - 'm': _1M, - 'g': _1G, - 't': 1024*_1G, - } - m = re.match(r'(\d+(\.\d+)?) (K|M|G|T)b?$', limit, - re.IGNORECASE | re.VERBOSE) - if m is None: - raise ValueError('Invalid memory limit %r' % (limit,)) - memlimit = int(float(m.group(1)) * sizes[m.group(3).lower()]) - if memlimit > MAX_Py_ssize_t: - memlimit = MAX_Py_ssize_t - if memlimit < _2G - 1: - raise ValueError('Memory limit %r too low to be useful' % (limit,)) - max_memuse = memlimit - -def bigmemtest(minsize, memuse, overhead=5*_1M): - """Decorator for bigmem tests. - - 'minsize' is the minimum useful size for the test (in arbitrary, - test-interpreted units.) 'memuse' is the number of 'bytes per size' for - the test, or a good estimate of it. 'overhead' specifies fixed overhead, - independant of the testsize, and defaults to 5Mb. - - The decorator tries to guess a good value for 'size' and passes it to - the decorated test function. If minsize * memuse is more than the - allowed memory use (as defined by max_memuse), the test is skipped. - Otherwise, minsize is adjusted upward to use up to max_memuse. - """ - def decorator(f): - def wrapper(self): - if not max_memuse: - # If max_memuse is 0 (the default), - # we still want to run the tests with size set to a few kb, - # to make sure they work. We still want to avoid using - # too much memory, though, but we do that noisily. - maxsize = 5147 - self.failIf(maxsize * memuse + overhead > 20 * _1M) - else: - maxsize = int((max_memuse - overhead) / memuse) - if maxsize < minsize: - # Really ought to print 'test skipped' or something - if verbose: - sys.stderr.write("Skipping %s because of memory " - "constraint\n" % (f.__name__,)) - return - # Try to keep some breathing room in memory use - maxsize = max(maxsize - 50 * _1M, minsize) - return f(self, maxsize) - wrapper.minsize = minsize - wrapper.memuse = memuse - wrapper.overhead = overhead - return wrapper - return decorator - -def bigaddrspacetest(f): - """Decorator for tests that fill the address space.""" - def wrapper(self): - if max_memuse < MAX_Py_ssize_t: - if verbose: - sys.stderr.write("Skipping %s because of memory " - "constraint\n" % (f.__name__,)) - else: - return f(self) - return wrapper - -#======================================================================= -# unittest integration. - -class BasicTestRunner: - def run(self, test): - result = unittest.TestResult() - test(result) - return result - - -def _run_suite(suite): - """Run tests from a unittest.TestSuite-derived class.""" - if verbose: - runner = unittest.TextTestRunner(sys.stdout, verbosity=2) - else: - runner = BasicTestRunner() - - result = runner.run(suite) - if not result.wasSuccessful(): - if len(result.errors) == 1 and not result.failures: - err = result.errors[0][1] - elif len(result.failures) == 1 and not result.errors: - err = result.failures[0][1] - else: - err = "errors occurred; run in verbose mode for details" - raise TestFailed(err) - - -def run_unittest(*classes): - """Run tests from unittest.TestCase-derived classes.""" - valid_types = (unittest.TestSuite, unittest.TestCase) - suite = unittest.TestSuite() - for cls in classes: - if isinstance(cls, str): - if cls in sys.modules: - suite.addTest(unittest.findTestCases(sys.modules[cls])) - else: - raise ValueError("str arguments must be keys in sys.modules") - elif isinstance(cls, valid_types): - suite.addTest(cls) - else: - suite.addTest(unittest.makeSuite(cls)) - _run_suite(suite) - - -#======================================================================= -# doctest driver. - -def run_doctest(module, verbosity=None): - """Run doctest on the given module. Return (#failures, #tests). - - If optional argument verbosity is not specified (or is None), pass - test_support's belief about verbosity on to doctest. Else doctest's - usual behavior is used (it searches sys.argv for -v). - """ - - import doctest - - if verbosity is None: - verbosity = verbose - else: - verbosity = None - - # Direct doctest output (normally just errors) to real stdout; doctest - # output shouldn't be compared by regrtest. - save_stdout = sys.stdout - sys.stdout = get_original_stdout() - try: - f, t = doctest.testmod(module, verbose=verbosity) - if f: - raise TestFailed("%d of %d doctests failed" % (f, t)) - finally: - sys.stdout = save_stdout - if verbose: - print 'doctest (%s) ... %d tests with zero failures' % (module.__name__, t) - return f, t - -#======================================================================= -# Threading support to prevent reporting refleaks when running regrtest.py -R - -def threading_setup(): - import threading - return len(threading._active), len(threading._limbo) - -def threading_cleanup(num_active, num_limbo): - import threading - import time - - _MAX_COUNT = 10 - count = 0 - while len(threading._active) != num_active and count < _MAX_COUNT: - count += 1 - time.sleep(0.1) - - count = 0 - while len(threading._limbo) != num_limbo and count < _MAX_COUNT: - count += 1 - time.sleep(0.1) - -def reap_children(): - """Use this function at the end of test_main() whenever sub-processes - are started. This will help ensure that no extra children (zombies) - stick around to hog resources and create problems when looking - for refleaks. - """ - - # Reap all our dead child processes so we don't leave zombies around. - # These hog resources and might be causing some of the buildbots to die. - if hasattr(os, 'waitpid'): - any_process = -1 - while True: - try: - # This will raise an exception on Windows. That's ok. - pid, status = os.waitpid(any_process, os.WNOHANG) - if pid == 0: - break - except: - break Index: Lib/test/support.py =================================================================== --- Lib/test/support.py (revision 62290) +++ Lib/test/support.py (working copy) @@ -1,7 +1,7 @@ """Supporting definitions for the Python regression tests.""" -if __name__ != 'test.test_support': - raise ImportError('test_support must be imported from the test package') +if __name__ != 'test.support': + raise ImportError('support must be imported from the test package') import contextlib import errno @@ -650,7 +650,7 @@ """Run doctest on the given module. Return (#failures, #tests). If optional argument verbosity is not specified (or is None), pass - test_support's belief about verbosity on to doctest. Else doctest's + support's belief about verbosity on to doctest. Else doctest's usual behavior is used (it searches sys.argv for -v). """ Index: Lib/test/test_collections.py =================================================================== --- Lib/test/test_collections.py (revision 62290) +++ Lib/test/test_collections.py (working copy) @@ -1,5 +1,5 @@ import unittest, doctest -from test import test_support +from test import support from collections import namedtuple from collections import Hashable, Iterable, Iterator from collections import Sized, Container, Callable @@ -309,8 +309,8 @@ def test_main(verbose=None): NamedTupleDocs = doctest.DocTestSuite(module=collections) test_classes = [TestNamedTuple, NamedTupleDocs, TestOneTrickPonyABCs, TestCollectionABCs] - test_support.run_unittest(*test_classes) - test_support.run_doctest(collections, verbose) + support.run_unittest(*test_classes) + support.run_doctest(collections, verbose) if __name__ == "__main__": test_main(verbose=True) Index: Lib/test/test_sys.py =================================================================== --- Lib/test/test_sys.py (revision 62290) +++ Lib/test/test_sys.py (working copy) @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -import unittest, test.test_support +import unittest, test.support import sys, cStringIO class SysModuleTest(unittest.TestCase): @@ -174,7 +174,7 @@ def test_getdefaultencoding(self): - if test.test_support.have_unicode: + if test.support.have_unicode: self.assertRaises(TypeError, sys.getdefaultencoding, 42) # can't check more than the type, as the user might have changed it self.assert_(isinstance(sys.getdefaultencoding(), str)) @@ -333,7 +333,7 @@ self.assertEqual(sys.float_info.radix, 2) self.assert_(isinstance(sys.hexversion, int)) self.assert_(isinstance(sys.maxint, int)) - if test.test_support.have_unicode: + if test.support.have_unicode: self.assert_(isinstance(sys.maxunicode, int)) self.assert_(isinstance(sys.platform, basestring)) self.assert_(isinstance(sys.prefix, basestring)) @@ -386,7 +386,7 @@ ## self.assert_(r[1][2] > 100, r[1][2]) def test_main(): - test.test_support.run_unittest(SysModuleTest) + test.support.run_unittest(SysModuleTest) if __name__ == "__main__": test_main() Index: Lib/test/test_lib2to3.py =================================================================== --- Lib/test/test_lib2to3.py (revision 62290) +++ Lib/test/test_lib2to3.py (working copy) @@ -2,7 +2,7 @@ # because of running from lib2to3.tests import test_fixers, test_pytree, test_util import unittest -from test.test_support import run_unittest +from test.support import run_unittest def suite(): tests = unittest.TestSuite() Index: Lib/test/test_posixpath.py =================================================================== --- Lib/test/test_posixpath.py (revision 62290) +++ Lib/test/test_posixpath.py (working copy) @@ -1,5 +1,5 @@ import unittest -from test import test_support +from test import support import posixpath, os from posixpath import realpath, abspath, join, dirname, basename, relpath @@ -7,7 +7,7 @@ # An absolute path to a temporary filename for testing. We can't rely on TESTFN # being an absolute path, so we need this. -ABSTFN = abspath(test_support.TESTFN) +ABSTFN = abspath(support.TESTFN) def safe_rmdir(dirname): try: @@ -22,8 +22,8 @@ def tearDown(self): for suffix in ["", "1", "2"]: - test_support.unlink(test_support.TESTFN + suffix) - safe_rmdir(test_support.TESTFN + suffix) + support.unlink(support.TESTFN + suffix) + safe_rmdir(support.TESTFN + suffix) def assertIs(self, a, b): self.assert_(a is b) @@ -141,50 +141,50 @@ self.assertNotEqual(s1[n:n+1], s2[n:n+1]) def test_getsize(self): - f = open(test_support.TESTFN, "wb") + f = open(support.TESTFN, "wb") try: f.write("foo") f.close() - self.assertEqual(posixpath.getsize(test_support.TESTFN), 3) + self.assertEqual(posixpath.getsize(support.TESTFN), 3) finally: if not f.closed: f.close() def test_time(self): - f = open(test_support.TESTFN, "wb") + f = open(support.TESTFN, "wb") try: f.write("foo") f.close() - f = open(test_support.TESTFN, "ab") + f = open(support.TESTFN, "ab") f.write("bar") f.close() - f = open(test_support.TESTFN, "rb") + f = open(support.TESTFN, "rb") d = f.read() f.close() self.assertEqual(d, "foobar") self.assert_( - posixpath.getctime(test_support.TESTFN) <= - posixpath.getmtime(test_support.TESTFN) + posixpath.getctime(support.TESTFN) <= + posixpath.getmtime(support.TESTFN) ) finally: if not f.closed: f.close() def test_islink(self): - self.assertIs(posixpath.islink(test_support.TESTFN + "1"), False) - f = open(test_support.TESTFN + "1", "wb") + self.assertIs(posixpath.islink(support.TESTFN + "1"), False) + f = open(support.TESTFN + "1", "wb") try: f.write("foo") f.close() - self.assertIs(posixpath.islink(test_support.TESTFN + "1"), False) + self.assertIs(posixpath.islink(support.TESTFN + "1"), False) if hasattr(os, "symlink"): - os.symlink(test_support.TESTFN + "1", test_support.TESTFN + "2") - self.assertIs(posixpath.islink(test_support.TESTFN + "2"), True) - os.remove(test_support.TESTFN + "1") - self.assertIs(posixpath.islink(test_support.TESTFN + "2"), True) - self.assertIs(posixpath.exists(test_support.TESTFN + "2"), False) - self.assertIs(posixpath.lexists(test_support.TESTFN + "2"), True) + os.symlink(support.TESTFN + "1", support.TESTFN + "2") + self.assertIs(posixpath.islink(support.TESTFN + "2"), True) + os.remove(support.TESTFN + "1") + self.assertIs(posixpath.islink(support.TESTFN + "2"), True) + self.assertIs(posixpath.exists(support.TESTFN + "2"), False) + self.assertIs(posixpath.lexists(support.TESTFN + "2"), True) finally: if not f.close(): f.close() @@ -192,13 +192,13 @@ self.assertRaises(TypeError, posixpath.islink) def test_exists(self): - self.assertIs(posixpath.exists(test_support.TESTFN), False) - f = open(test_support.TESTFN, "wb") + self.assertIs(posixpath.exists(support.TESTFN), False) + f = open(support.TESTFN, "wb") try: f.write("foo") f.close() - self.assertIs(posixpath.exists(test_support.TESTFN), True) - self.assertIs(posixpath.lexists(test_support.TESTFN), True) + self.assertIs(posixpath.exists(support.TESTFN), True) + self.assertIs(posixpath.lexists(support.TESTFN), True) finally: if not f.close(): f.close() @@ -206,16 +206,16 @@ self.assertRaises(TypeError, posixpath.exists) def test_isdir(self): - self.assertIs(posixpath.isdir(test_support.TESTFN), False) - f = open(test_support.TESTFN, "wb") + self.assertIs(posixpath.isdir(support.TESTFN), False) + f = open(support.TESTFN, "wb") try: f.write("foo") f.close() - self.assertIs(posixpath.isdir(test_support.TESTFN), False) - os.remove(test_support.TESTFN) - os.mkdir(test_support.TESTFN) - self.assertIs(posixpath.isdir(test_support.TESTFN), True) - os.rmdir(test_support.TESTFN) + self.assertIs(posixpath.isdir(support.TESTFN), False) + os.remove(support.TESTFN) + os.mkdir(support.TESTFN) + self.assertIs(posixpath.isdir(support.TESTFN), True) + os.rmdir(support.TESTFN) finally: if not f.close(): f.close() @@ -223,16 +223,16 @@ self.assertRaises(TypeError, posixpath.isdir) def test_isfile(self): - self.assertIs(posixpath.isfile(test_support.TESTFN), False) - f = open(test_support.TESTFN, "wb") + self.assertIs(posixpath.isfile(support.TESTFN), False) + f = open(support.TESTFN, "wb") try: f.write("foo") f.close() - self.assertIs(posixpath.isfile(test_support.TESTFN), True) - os.remove(test_support.TESTFN) - os.mkdir(test_support.TESTFN) - self.assertIs(posixpath.isfile(test_support.TESTFN), False) - os.rmdir(test_support.TESTFN) + self.assertIs(posixpath.isfile(support.TESTFN), True) + os.remove(support.TESTFN) + os.mkdir(support.TESTFN) + self.assertIs(posixpath.isfile(support.TESTFN), False) + os.rmdir(support.TESTFN) finally: if not f.close(): f.close() @@ -240,14 +240,14 @@ self.assertRaises(TypeError, posixpath.isdir) def test_samefile(self): - f = open(test_support.TESTFN + "1", "wb") + f = open(support.TESTFN + "1", "wb") try: f.write("foo") f.close() self.assertIs( posixpath.samefile( - test_support.TESTFN + "1", - test_support.TESTFN + "1" + support.TESTFN + "1", + support.TESTFN + "1" ), True ) @@ -255,24 +255,24 @@ # inode information and thus, that samefile() doesn't work if hasattr(os, "symlink"): os.symlink( - test_support.TESTFN + "1", - test_support.TESTFN + "2" + support.TESTFN + "1", + support.TESTFN + "2" ) self.assertIs( posixpath.samefile( - test_support.TESTFN + "1", - test_support.TESTFN + "2" + support.TESTFN + "1", + support.TESTFN + "2" ), True ) - os.remove(test_support.TESTFN + "2") - f = open(test_support.TESTFN + "2", "wb") + os.remove(support.TESTFN + "2") + f = open(support.TESTFN + "2", "wb") f.write("bar") f.close() self.assertIs( posixpath.samefile( - test_support.TESTFN + "1", - test_support.TESTFN + "2" + support.TESTFN + "1", + support.TESTFN + "2" ), False ) @@ -283,14 +283,14 @@ self.assertRaises(TypeError, posixpath.samefile) def test_samestat(self): - f = open(test_support.TESTFN + "1", "wb") + f = open(support.TESTFN + "1", "wb") try: f.write("foo") f.close() self.assertIs( posixpath.samestat( - os.stat(test_support.TESTFN + "1"), - os.stat(test_support.TESTFN + "1") + os.stat(support.TESTFN + "1"), + os.stat(support.TESTFN + "1") ), True ) @@ -298,22 +298,22 @@ # inode information and thus, that samefile() doesn't work if hasattr(os, "symlink"): if hasattr(os, "symlink"): - os.symlink(test_support.TESTFN + "1", test_support.TESTFN + "2") + os.symlink(support.TESTFN + "1", support.TESTFN + "2") self.assertIs( posixpath.samestat( - os.stat(test_support.TESTFN + "1"), - os.stat(test_support.TESTFN + "2") + os.stat(support.TESTFN + "1"), + os.stat(support.TESTFN + "2") ), True ) - os.remove(test_support.TESTFN + "2") - f = open(test_support.TESTFN + "2", "wb") + os.remove(support.TESTFN + "2") + f = open(support.TESTFN + "2", "wb") f.write("bar") f.close() self.assertIs( posixpath.samestat( - os.stat(test_support.TESTFN + "1"), - os.stat(test_support.TESTFN + "2") + os.stat(support.TESTFN + "1"), + os.stat(support.TESTFN + "2") ), False ) @@ -399,7 +399,7 @@ os.symlink(ABSTFN+"1", ABSTFN) self.assertEqual(realpath(ABSTFN), ABSTFN+"1") finally: - test_support.unlink(ABSTFN) + support.unlink(ABSTFN) def test_realpath_symlink_loops(self): # Bug #930024, return the path unchanged if we get into an infinite @@ -419,9 +419,9 @@ self.assertEqual(realpath(basename(ABSTFN)), ABSTFN) finally: os.chdir(old_path) - test_support.unlink(ABSTFN) - test_support.unlink(ABSTFN+"1") - test_support.unlink(ABSTFN+"2") + support.unlink(ABSTFN) + support.unlink(ABSTFN+"1") + support.unlink(ABSTFN+"2") def test_realpath_resolve_parents(self): # We also need to resolve any symlinks in the parents of a relative @@ -438,7 +438,7 @@ self.assertEqual(realpath("a"), ABSTFN + "/y/a") finally: os.chdir(old_path) - test_support.unlink(ABSTFN + "/k") + support.unlink(ABSTFN + "/k") safe_rmdir(ABSTFN + "/y") safe_rmdir(ABSTFN) @@ -464,7 +464,7 @@ self.assertEqual(realpath(basename(ABSTFN) + "/link-y/.."), ABSTFN + "/k") finally: os.chdir(old_path) - test_support.unlink(ABSTFN + "/link-y") + support.unlink(ABSTFN + "/link-y") safe_rmdir(ABSTFN + "/k/y") safe_rmdir(ABSTFN + "/k") safe_rmdir(ABSTFN) @@ -485,7 +485,7 @@ self.assertEqual(realpath(base + "link/k"), ABSTFN + "/k") finally: os.chdir(old_path) - test_support.unlink(ABSTFN + "link") + support.unlink(ABSTFN + "link") safe_rmdir(ABSTFN + "/k") safe_rmdir(ABSTFN) @@ -506,7 +506,7 @@ os.getcwd = real_getcwd def test_main(): - test_support.run_unittest(PosixPathTest) + support.run_unittest(PosixPathTest) if __name__=="__main__": test_main() Index: Lib/test/test_popen.py =================================================================== --- Lib/test/test_popen.py (revision 62290) +++ Lib/test/test_popen.py (working copy) @@ -5,7 +5,7 @@ """ import unittest -from test import test_support +from test import support import os, sys # Test that command-lines get down as we expect. @@ -38,10 +38,10 @@ 'foo "a \\"quoted\\" arg" bar', ["foo", 'a "quoted" arg', "bar"] ) - test_support.reap_children() + support.reap_children() def test_main(): - test_support.run_unittest(PopenTest) + support.run_unittest(PopenTest) if __name__ == "__main__": test_main() Index: Lib/test/test_email_renamed.py =================================================================== --- Lib/test/test_email_renamed.py (revision 62290) +++ Lib/test/test_email_renamed.py (working copy) @@ -3,10 +3,10 @@ # The specific tests now live in Lib/email/test from email.test.test_email_renamed import suite -from test import test_support +from test import support def test_main(): - test_support.run_unittest(suite()) + support.run_unittest(suite()) if __name__ == '__main__': test_main() Index: Lib/test/test_urllib2net.py =================================================================== --- Lib/test/test_urllib2net.py (revision 62290) +++ Lib/test/test_urllib2net.py (working copy) @@ -1,7 +1,7 @@ #!/usr/bin/env python import unittest -from test import test_support +from test import support from test.test_urllib2 import sanepathname2url import socket @@ -106,7 +106,7 @@ self._test_urls(urls, self._extra_handlers()) def test_file(self): - TESTFN = test_support.TESTFN + TESTFN = support.TESTFN f = open(TESTFN, 'w') try: f.write('hi there\n') @@ -170,7 +170,7 @@ (expected_err, url, req, type(err), err)) self.assert_(isinstance(err, expected_err), msg) else: - with test_support.transient_internet(): + with support.transient_internet(): buf = f.read() f.close() debug("read %d bytes" % len(buf)) @@ -234,8 +234,8 @@ def test_main(): - test_support.requires("network") - test_support.run_unittest(AuthTests, + support.requires("network") + support.run_unittest(AuthTests, OtherNetworkTests, CloseSocketTest, TimeoutTest, Index: Lib/test/test_ast.py =================================================================== --- Lib/test/test_ast.py (revision 62290) +++ Lib/test/test_ast.py (working copy) @@ -1,5 +1,5 @@ import sys, itertools, unittest -from test import test_support +from test import support import _ast def to_tuple(t): @@ -182,7 +182,7 @@ self.assertEquals(to_tuple(ast2), to_tuple(ast)) def test_main(): - test_support.run_unittest(AST_Tests) + support.run_unittest(AST_Tests) def main(): if __name__ != '__main__': Index: Lib/test/test_format.py =================================================================== --- Lib/test/test_format.py (revision 62290) +++ Lib/test/test_format.py (working copy) @@ -1,9 +1,9 @@ import sys -from test.test_support import verbose, have_unicode, TestFailed -import test.test_support as test_support +from test.support import verbose, have_unicode, TestFailed +import test.support as support import unittest -maxsize = test_support.MAX_Py_ssize_t +maxsize = support.MAX_Py_ssize_t # test string formatting operator (I am not sure if this is being tested # elsewhere but, surely, some of the given cases are *not* tested because @@ -288,7 +288,7 @@ raise TestFailed, '"%*d"%(maxsize, -127) should fail' def test_main(): - test_support.run_unittest(FormatTest) + support.run_unittest(FormatTest) if __name__ == "__main__":