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 + import test.support as test_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 + import test.support as test_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 + import test.support as test_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 + import test.support as test_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 + import test.support as test_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 + import test.support as test_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 + import test.support as test_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 + import test.support as test_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 + import test.support as test_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 + import test.support as test_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 + import test.support as test_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 + import test.support as test_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 + import test.support as test_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 + import test.support as test_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 + import test.support as test_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_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_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_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/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/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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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.rmd