Index: Lib/distutils/tests/test_dist.py =================================================================== --- Lib/distutils/tests/test_dist.py (revision 62293) +++ 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 62293) +++ 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 62293) +++ 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/email/test/test_email_torture.py =================================================================== --- Lib/email/test/test_email_torture.py (revision 62293) +++ 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 @@ -128,7 +128,7 @@ def test_main(): for testclass in _testclasses(): - test_support.run_unittest(testclass) + support.run_unittest(testclass) Index: Lib/email/test/test_email_codecs_renamed.py =================================================================== --- Lib/email/test/test_email_codecs_renamed.py (revision 62293) +++ 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.py =================================================================== --- Lib/email/test/test_email.py (revision 62293) +++ Lib/email/test/test_email.py (working copy) @@ -34,7 +34,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 62293) +++ 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 62293) +++ 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 62293) +++ Lib/test/test_csv.py (working copy) @@ -10,7 +10,7 @@ from tempfile import TemporaryFile import csv import gc -from test import test_support +from test import support class Test_Csv(unittest.TestCase): """ @@ -790,7 +790,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): @@ -891,7 +891,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 62293) +++ 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 @@ -481,10 +481,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 62293) +++ 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) @@ -245,11 +245,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 62293) +++ Lib/test/test_optparse.py (working copy) @@ -15,7 +15,7 @@ import unittest from io import StringIO -from test import test_support +from test import support from optparse import make_option, Option, IndentedHelpFormatter, \ @@ -1004,10 +1004,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): @@ -1022,21 +1022,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): @@ -1611,7 +1611,7 @@ def test_main(): - test_support.run_unittest(__name__) + support.run_unittest(__name__) if __name__ == '__main__': test_main() Index: Lib/test/test_codecs.py =================================================================== --- Lib/test/test_codecs.py (revision 62293) +++ 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, _testcapi, io @@ -1032,7 +1032,7 @@ try: self.assertEquals(nameprep(orig), prepped) except Exception as 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): @@ -1477,7 +1477,7 @@ def test_main(): - test_support.run_unittest( + support.run_unittest( UTF32Test, UTF32LETest, UTF32BETest, Index: Lib/test/regrtest.py =================================================================== --- Lib/test/regrtest.py (revision 62293) +++ Lib/test/regrtest.py (working copy) @@ -171,7 +171,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') @@ -209,7 +209,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:n', ['help', 'verbose', 'quiet', 'exclude', @@ -284,7 +284,7 @@ # stringobject.c filling slowly with random data warm_char_cache() 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: @@ -390,8 +390,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: @@ -433,7 +433,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() @@ -479,7 +479,7 @@ print("Re-running test %r in verbose mode" % test) sys.stdout.flush() try: - test_support.verbose = True + support.verbose = True ok = runtest(test, generate, True, quiet, test_times, testdir, huntrleaks, debug) except KeyboardInterrupt: @@ -526,7 +526,7 @@ ] NOTTESTS = { - 'test_support', + 'support', 'test_future1', 'test_future2', } @@ -572,7 +572,7 @@ def runtest_inner(test, generate, verbose, quiet, test_times, testdir=None, huntrleaks=False, debug=False): - test_support.unload(test) + support.unload(test) if not testdir: testdir = findtestdir() if verbose: @@ -606,19 +606,19 @@ test_times.append((test_time, test)) finally: sys.stdout = save_stdout - except test_support.ResourceDenied as msg: + except support.ResourceDenied as msg: if not quiet: print(test, "skipped --", msg) sys.stdout.flush() return -2 - except (ImportError, test_support.TestSkipped) as msg: + except (ImportError, support.TestSkipped) as msg: if not quiet: print(test, "skipped --", msg) sys.stdout.flush() return -1 except KeyboardInterrupt: raise - except test_support.TestFailed as msg: + except support.TestFailed as msg: print("test", test, "failed --", msg) sys.stdout.flush() return 0 @@ -652,7 +652,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): @@ -1202,10 +1202,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_dictviews.py =================================================================== --- Lib/test/test_dictviews.py (revision 62293) +++ Lib/test/test_dictviews.py (working copy) @@ -1,5 +1,5 @@ import unittest -from test import test_support +from test import support class DictSetTest(unittest.TestCase): @@ -70,7 +70,7 @@ self.assertEqual(len(values), 2) def test_main(): - test_support.run_unittest(DictSetTest) + support.run_unittest(DictSetTest) if __name__ == "__main__": test_main() Index: Lib/test/test_robotparser.py =================================================================== --- Lib/test/test_robotparser.py (revision 62293) +++ Lib/test/test_robotparser.py (working copy) @@ -1,6 +1,6 @@ import unittest, robotparser import io -from test import test_support +from test import support class RobotTestCase(unittest.TestCase): def __init__(self, index, parser, url, good, agent): @@ -137,7 +137,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() @@ -146,9 +146,9 @@ self.assertEqual(parser.can_fetch("*", url+"/robots.txt"), False) def test_main(): - test_support.run_unittest(tests) + support.run_unittest(tests) TestCase().run() if __name__=='__main__': - test_support.Verbose = 1 + support.Verbose = 1 test_main() Index: Lib/test/test_xmlrpc.py =================================================================== --- Lib/test/test_xmlrpc.py (revision 62293) +++ 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 alist = [{'astring': 'foo@bar.baz.spam', 'afloat': 7283.43, @@ -535,20 +535,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): @@ -570,7 +570,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() @@ -580,13 +580,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, @@ -601,7 +601,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 62293) +++ Lib/test/test_pickle.py (working copy) @@ -1,7 +1,7 @@ import pickle import io -from test import test_support +from test import support from test.pickletester import AbstractPickleTests from test.pickletester import AbstractPickleModuleTests @@ -55,12 +55,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 62293) +++ 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 62293) +++ Lib/test/test_code.py (working copy) @@ -119,7 +119,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 62293) +++ 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 62293) +++ Lib/test/test_binhex.py (working copy) @@ -7,18 +7,18 @@ 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): - test_support.unlink(self.fname1) - test_support.unlink(self.fname2) + support.unlink(self.fname1) + support.unlink(self.fname2) DATA = b'Jack is my hero' @@ -39,7 +39,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 62293) +++ 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 62293) +++ 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' @@ -274,7 +274,7 @@ self.assertEqual(list(self.f), keys) class TestBTree(TestBSDDB): - fname = test_support.TESTFN + fname = support.TESTFN openmethod = [bsddb.btopen] class TestBTree_InMemory(TestBSDDB): @@ -287,7 +287,7 @@ openmethod = [bsddb.btopen] class TestHashTable(TestBSDDB): - fname = test_support.TESTFN + fname = support.TESTFN openmethod = [bsddb.hashopen] class TestHashTable_InMemory(TestBSDDB): @@ -299,7 +299,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 62293) +++ Lib/test/test_pep352.py (working copy) @@ -1,7 +1,7 @@ import unittest import builtins import warnings -from test.test_support import run_unittest +from test.support import run_unittest import os from platform import system as platform_system Index: Lib/test/test_symtable.py =================================================================== --- Lib/test/test_symtable.py (revision 62293) +++ 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_syslog.py =================================================================== --- Lib/test/test_syslog.py (revision 62293) +++ Lib/test/test_syslog.py (working copy) @@ -1,7 +1,7 @@ import syslog import unittest -from test import test_support +from test import support # XXX(nnorwitz): This test sucks. I don't know of a platform independent way # to verify that the messages were really logged. @@ -31,7 +31,7 @@ syslog.LOG_UPTO(syslog.LOG_INFO) def test_main(): - test_support.run_unittest(__name__) + support.run_unittest(__name__) if __name__ == "__main__": test_main() Index: Lib/test/test_exceptions.py =================================================================== --- Lib/test/test_exceptions.py (revision 62293) +++ Lib/test/test_exceptions.py (working copy) @@ -5,7 +5,7 @@ import unittest import pickle -from test.test_support import TESTFN, unlink, run_unittest +from test.support import TESTFN, unlink, run_unittest # XXX This is not really enough, each *operation* should be tested! Index: Lib/test/test_sundry.py =================================================================== --- Lib/test/test_sundry.py (revision 62293) +++ Lib/test/test_sundry.py (working copy) @@ -1,13 +1,13 @@ """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 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 @@ -102,7 +102,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 @@ -113,7 +113,7 @@ def test_main(): - test_support.run_unittest(TestUntestedModules) + support.run_unittest(TestUntestedModules) if __name__ == "__main__": test_main() Index: Lib/test/test_univnewlines.py =================================================================== --- Lib/test/test_univnewlines.py (revision 62293) +++ 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) @@ -35,7 +35,7 @@ WRITEMODE = 'wb' def setUp(self): - fp = open(test_support.TESTFN, self.WRITEMODE) + fp = open(support.TESTFN, self.WRITEMODE) data = self.DATA if "b" in self.WRITEMODE: data = data.encode("ascii") @@ -44,24 +44,24 @@ 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: @@ -71,7 +71,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() @@ -94,7 +94,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() @@ -106,7 +106,7 @@ def test_main(): - test_support.run_unittest( + support.run_unittest( TestCRNewlines, TestLFNewlines, TestCRLFNewlines, Index: Lib/test/test_warnings.py =================================================================== --- Lib/test/test_warnings.py (revision 62293) +++ Lib/test/test_warnings.py (working copy) @@ -4,7 +4,7 @@ from io import StringIO import sys import unittest -from test import test_support +from test import support from test 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 62293) +++ Lib/test/test_tokenize.py (working copy) @@ -60,7 +60,7 @@ ... " print(x)\\n") True - >>> f = test_support.findfile("tokenize_tests.txt") + >>> f = support.findfile("tokenize_tests.txt") >>> roundtrip(open(f, 'rb')) True @@ -522,7 +522,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: @@ -533,7 +533,7 @@ True """ -from test import test_support +from test import support from tokenize import (tokenize, _tokenize, untokenize, NUMBER, NAME, OP, STRING, ENDMARKER, tok_name, detect_encoding) from io import BytesIO @@ -842,11 +842,11 @@ def test_main(): from test import test_tokenize - test_support.run_doctest(test_tokenize, True) - test_support.run_unittest(TestTokenizerAdheresToPep0263) - test_support.run_unittest(Test_Tokenize) - test_support.run_unittest(TestDetectEncoding) - test_support.run_unittest(TestTokenize) + support.run_doctest(test_tokenize, True) + support.run_unittest(TestTokenizerAdheresToPep0263) + support.run_unittest(Test_Tokenize) + support.run_unittest(TestDetectEncoding) + support.run_unittest(TestTokenize) if __name__ == "__main__": test_main() Index: Lib/test/test_tuple.py =================================================================== --- Lib/test/test_tuple.py (revision 62293) +++ 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 62293) +++ 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): @@ -473,8 +473,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 62293) +++ 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_ALL, LC_CTYPE, LC_NUMERIC, RADIXCHAR, THOUSEP, nl_langinfo, localeconv, Error) import unittest Index: Lib/test/test_global.py =================================================================== --- Lib/test/test_global.py (revision 62293) +++ 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 62293) +++ 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 62293) +++ Lib/test/test_cmd.py (working copy) @@ -167,8 +167,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) def test_coverage(coverdir): tracer=trace.Trace(ignoredirs=[sys.prefix, sys.exec_prefix,], Index: Lib/test/test_ctypes.py =================================================================== --- Lib/test/test_ctypes.py (revision 62293) +++ 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 62293) +++ Lib/test/test_io.py (working copy) @@ -6,7 +6,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 @@ -80,10 +80,10 @@ class IOTest(unittest.TestCase): def setUp(self): - test_support.unlink(test_support.TESTFN) + support.unlink(support.TESTFN) 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) @@ -149,13 +149,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) @@ -163,13 +163,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) @@ -177,10 +177,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") @@ -201,7 +201,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, @@ -209,22 +209,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) @@ -243,31 +243,31 @@ 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() def test_array_writes(self): 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: @@ -638,10 +638,10 @@ def setUp(self): self.testdata = b"AAA\r\nBBB\rCCC\r\nDDD\nEEE\r\n" self.normalized = b"AAA\nBBB\nCCC\nDDD\nEEE\n".decode("ascii") - test_support.unlink(test_support.TESTFN) + support.unlink(support.TESTFN) def tearDown(self): - test_support.unlink(test_support.TESTFN) + support.unlink(support.TESTFN) def testLineBuffering(self): r = io.BytesIO() @@ -816,11 +816,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("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(), "abc") @@ -863,7 +863,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("\xff\n") p1 = f.tell() @@ -891,10 +891,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, str(prefix, "ascii")) self.assertEquals(f.tell(), prefix_size) @@ -903,10 +903,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() @@ -918,16 +918,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]) @@ -983,7 +983,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): @@ -1003,7 +1003,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) @@ -1160,7 +1160,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 62293) +++ Lib/test/test_mimetools.py (working copy) @@ -1,5 +1,5 @@ import unittest -from test import test_support +from test import support import string, mimetools import io @@ -70,7 +70,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 62293) +++ 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 62293) +++ 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, b"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, b"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() @@ -401,7 +401,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 62293) +++ Lib/test/test_dumbdbm.py (working copy) @@ -7,9 +7,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"]: @@ -177,7 +177,7 @@ def test_main(): try: - test_support.run_unittest(DumbDBMTestCase) + support.run_unittest(DumbDBMTestCase) finally: _delete_files() Index: Lib/test/test_xmlrpc_net.py =================================================================== --- Lib/test/test_xmlrpc_net.py (revision 62293) +++ Lib/test/test_xmlrpc_net.py (working copy) @@ -4,7 +4,7 @@ import socket import sys import unittest -from test import test_support +from test import support import xmlrpclib @@ -37,8 +37,8 @@ def test_main(): - test_support.requires("network") - test_support.run_unittest(CurrentTimeTest) + support.requires("network") + support.run_unittest(CurrentTimeTest) if __name__ == "__main__": test_main() Index: Lib/test/test_imaplib.py =================================================================== --- Lib/test/test_imaplib.py (revision 62293) +++ 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 62293) +++ 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 = """\ @@ -265,7 +265,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 62293) +++ 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 62293) +++ Lib/test/test_asyncore.py (working copy) @@ -7,12 +7,12 @@ 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 io import BytesIO from io import StringIO -HOST = test_support.HOST +HOST = support.HOST class dummysocket: def __init__(self): @@ -334,7 +334,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 = BytesIO() args = (self.evt, cap, self.sock) Index: Lib/test/test_dict.py =================================================================== --- Lib/test/test_dict.py (revision 62293) +++ Lib/test/test_dict.py (working copy) @@ -1,5 +1,5 @@ import unittest -from test import test_support +from test import support import sys, collections, random, string @@ -651,7 +651,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 62293) +++ 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 62293) +++ 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_set.py =================================================================== --- Lib/test/test_set.py (revision 62293) +++ 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 @@ -288,14 +288,14 @@ s = self.thetype([w]) w.value = s try: - fo = open(test_support.TESTFN, "w") + fo = open(support.TESTFN, "w") fo.write(str(s)) fo.close() - fo = open(test_support.TESTFN, "r") + fo = open(support.TESTFN, "r") 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 @@ -672,14 +672,14 @@ def test_print(self): try: - fo = open(test_support.TESTFN, "w") + fo = open(support.TESTFN, "w") fo.write(str(self.set)) fo.close() - fo = open(test_support.TESTFN, "r") + fo = open(support.TESTFN, "r") 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) @@ -1752,14 +1752,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 range(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 62293) +++ 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): @@ -2449,12 +2449,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) @@ -2466,7 +2466,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 ... @@ -4093,7 +4093,7 @@ def test_main(): # Run all local test cases, with PTypesLongInitTest first. - test_support.run_unittest(PTypesLongInitTest, OperatorsTest, + support.run_unittest(PTypesLongInitTest, OperatorsTest, ClassPropertiesAndMethods, DictProxyTests) if __name__ == "__main__": Index: Lib/test/test_crypt.py =================================================================== --- Lib/test/test_crypt.py (revision 62293) +++ Lib/test/test_crypt.py (working copy) @@ -1,4 +1,4 @@ -from test import test_support +from test import support import unittest import crypt @@ -6,11 +6,11 @@ def test_crypt(self): c = crypt.crypt('mypassword', 'ab') - if test_support.verbose: + if support.verbose: print('Test encryption: ', c) def test_main(): - test_support.run_unittest(CryptTestCase) + support.run_unittest(CryptTestCase) if __name__ == "__main__": test_main() Index: Lib/test/test_ssl.py =================================================================== --- Lib/test/test_ssl.py (revision 62293) +++ 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 select import errno @@ -25,27 +25,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 @@ -69,7 +69,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")) @@ -86,7 +86,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): @@ -96,7 +96,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 NetworkedTests(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 as x: - raise test_support.TestFailed("Unexpected exception %s" % x) + raise support.TestFailed("Unexpected exception %s" % x) finally: s.close() @@ -151,14 +151,14 @@ else: raise s.close() - if test_support.verbose: + if support.verbose: sys.stdout.write("\nNeeded %d calls to do_handshake() to establish session.\n" % count) def testFetchServerCert(self): 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!") return @@ -166,15 +166,15 @@ pem = ssl.get_server_certificate(("svn.python.org", 443), ca_certs=CERTFILE) except ssl.SSLError as x: #should fail - if test_support.verbose: + if support.verbose: sys.stdout.write("%s\n" % x) 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) @@ -227,13 +227,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 @@ -269,19 +269,19 @@ self.running = False self.close() elif amsg.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 amsg.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".encode("ASCII", "strict")) 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" @@ -314,7 +314,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) @@ -334,7 +334,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 ' + repr(connaddr) + '\n') handler = self.ConnectionHandler(self, newconn, connaddr) @@ -457,7 +457,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_address, self.server.server_port, @@ -470,7 +470,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) @@ -522,7 +522,7 @@ def handle_read(self): data = self.recv(1024) - if test_support.verbose: + if support.verbose: sys.stdout.write(" server: read %s from client\n" % repr(data)) if not data: self.close() @@ -530,7 +530,7 @@ self.send(str(data, 'ASCII', 'strict').lower().encode('ASCII', 'strict')) def handle_close(self): - if test_support.verbose: + if support.verbose: sys.stdout.write(" server: closed connection %s\n" % self.socket) def handle_error(self): @@ -546,7 +546,7 @@ def handle_accept(self): sock_obj, addr = self.accept() - if test_support.verbose: + if support.verbose: sys.stdout.write(" server: new connection from %s:%s\n" %addr) self.ConnectionHandler(sock_obj, self.certfile) @@ -556,7 +556,7 @@ def __init__(self, certfile): self.flag = None self.active = False - self.port = test_support.find_unused_port() + self.port = support.find_unused_port() self.server = self.EchoServer(self.port, certfile) threading.Thread.__init__(self) self.setDaemon(True) @@ -599,10 +599,10 @@ ssl_version=ssl.PROTOCOL_TLSv1) s.connect((HOST, server.port)) except ssl.SSLError as x: - if test_support.verbose: + if support.verbose: sys.stdout.write("\nSSLError is %s\n" % x) else: - raise test_support.TestFailed( + raise support.TestFailed( "Use of invalid cert should have failed!") finally: server.stop() @@ -635,28 +635,28 @@ ssl_version=client_protocol) s.connect((HOST, server.port)) except ssl.SSLError as x: - raise test_support.TestFailed("Unexpected SSL error: " + str(x)) + raise support.TestFailed("Unexpected SSL error: " + str(x)) except Exception as 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.encode('ASCII', 'strict')) outdata = s.read() if connectionchatty: - if test_support.verbose: + if support.verbose: sys.stdout.write(" client: read %s\n" % repr(outdata)) outdata = str(outdata, 'ASCII', 'strict') if outdata != indata.lower(): - raise test_support.TestFailed( + raise support.TestFailed( "bad data <<%s>> (%d) received; expected <<%s>> (%d)\n" % (repr(outdata[:min(len(outdata),20)]), len(outdata), repr(indata[:min(len(indata),20)].lower()), len(indata))) s.write("over\n".encode("ASCII", "strict")) if connectionchatty: - if test_support.verbose: + if support.verbose: sys.stdout.write(" client: closing connection.\n") s.close() finally: @@ -677,7 +677,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), @@ -687,12 +687,12 @@ serverParamsTest(CERTFILE, server_protocol, certsreqs, CERTFILE, CERTFILE, client_protocol, chatty=False, connectionchatty=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))) @@ -702,7 +702,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, @@ -710,7 +710,7 @@ def testReadCert(self): - if test_support.verbose: + if support.verbose: sys.stdout.write("\n") s2 = socket.socket() server = ThreadedEchoServer(CERTFILE, @@ -732,30 +732,30 @@ ssl_version=ssl.PROTOCOL_SSLv23) s.connect((HOST, server.port)) except ssl.SSLError as x: - raise test_support.TestFailed( + raise support.TestFailed( "Unexpected SSL error: " + str(x)) except Exception as 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 'subject' not in cert: - 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() @@ -777,7 +777,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. @@ -802,7 +802,7 @@ except IOError: pass else: - raise test_support.TestFailed( + raise support.TestFailed( 'connecting to closed SSL socket should have failed') t = threading.Thread(target=listener) @@ -811,7 +811,7 @@ t.join() 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) @@ -821,13 +821,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 as x: + except support.TestFailed as 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)) @@ -844,7 +844,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) @@ -854,7 +854,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) @@ -884,13 +884,13 @@ s.setblocking(1) s.connect((HOST, server.port)) except Exception as 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: msg = indata.encode('ASCII', 'replace') - if test_support.verbose: + if support.verbose: sys.stdout.write( " client: sending %s...\n" % repr(msg)) if wrapped: @@ -901,7 +901,7 @@ outdata = s.recv(1024) if (indata == "STARTTLS" and str(outdata, 'ASCII', 'replace').strip().lower().startswith("ok")): - if test_support.verbose: + if support.verbose: msg = str(outdata, 'ASCII', 'replace') sys.stdout.write( " client: read %s from server, starting TLS...\n" @@ -910,11 +910,11 @@ wrapped = True else: - if test_support.verbose: + if support.verbose: msg = str(outdata, 'ASCII', 'replace') sys.stdout.write( " client: read %s from server\n" % repr(msg)) - if test_support.verbose: + if support.verbose: sys.stdout.write(" client: closing connection.\n") if wrapped: conn.write("over\n".encode("ASCII", "strict")) @@ -937,7 +937,7 @@ flag.wait() # try to connect try: - if test_support.verbose: + if support.verbose: sys.stdout.write('\n') d1 = open(CERTFILE, 'rb').read() d2 = '' @@ -948,33 +948,33 @@ 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): print("d1 is", len(d1), repr(d1)) print("d2 is", len(d2), repr(d2)) - raise test_support.TestFailed( + raise support.TestFailed( "Couldn't fetch data from HTTPS server") finally: - if test_support.verbose: + if support.verbose: sys.stdout.write('stopping server\n') server.stop() - if test_support.verbose: + if support.verbose: sys.stdout.write('joining thread\n') server.join() def testAsyncoreServer(self): - if test_support.verbose: + if support.verbose: sys.stdout.write("\n") indata="FOO\n" @@ -988,25 +988,25 @@ s = ssl.wrap_socket(socket.socket()) s.connect((HOST, server.port)) except ssl.SSLError as x: - raise test_support.TestFailed("Unexpected SSL error: " + str(x)) + raise support.TestFailed("Unexpected SSL error: " + str(x)) except Exception as 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( " client: sending %s...\n" % (repr(indata))) s.sendall(indata.encode('ASCII', 'strict')) outdata = s.recv() - if test_support.verbose: + if support.verbose: sys.stdout.write(" client: read %s\n" % repr(outdata)) outdata = str(outdata, 'ASCII', 'strict') if outdata != indata.lower(): - raise test_support.TestFailed( + raise support.TestFailed( "bad data <<%s>> (%d) received; expected <<%s>> (%d)\n" % (repr(outdata[:min(len(outdata),20)]), len(outdata), repr(indata[:min(len(indata),20)].lower()), len(indata))) s.write("over\n".encode("ASCII", "strict")) - if test_support.verbose: + if support.verbose: sys.stdout.write(" client: closing connection.\n") s.close() finally: @@ -1015,7 +1015,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, @@ -1026,22 +1026,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(NetworkedTests) 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(ThreadedTests) - test_support.run_unittest(*tests) + support.run_unittest(*tests) if _have_threads: - test_support.threading_cleanup(*thread_info) + support.threading_cleanup(*thread_info) if __name__ == "__main__": test_main() Index: Lib/test/test_frozen.py =================================================================== --- Lib/test/test_frozen.py (revision 62293) +++ 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 62293) +++ 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(b"\n") f.write(s) f.close() - f = open(test_support.TESTFN, "rb") + f = open(support.TESTFN, "rb") line = f.readline() self.assertEqual(line, s + b"\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(bytes(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 62293) +++ 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 io from traceback import print_exc Index: Lib/test/test_winsound.py =================================================================== --- Lib/test/test_winsound.py (revision 62293) +++ Lib/test/test_winsound.py (working copy) @@ -1,8 +1,8 @@ # Ridiculously simple test of the winsound module for Windows. import unittest -from test import test_support -test_support.requires('audio') +from test import support +support.requires('audio') import winsound, time import os import subprocess @@ -226,7 +226,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 62293) +++ Lib/test/test_complex.py (working copy) @@ -1,5 +1,5 @@ import unittest, os -from test import test_support +from test import support from random import random from math import atan2 @@ -339,16 +339,16 @@ fo = None try: - fo = open(test_support.TESTFN, "w") + fo = open(support.TESTFN, "w") print(a, b, file=fo) fo.close() - fo = open(test_support.TESTFN, "r") + fo = open(support.TESTFN, "r") 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 @@ -360,7 +360,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 62293) +++ 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(b'a', b'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 62293) +++ Lib/test/test_generators.py (working copy) @@ -1874,8 +1874,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 62293) +++ 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 range(len(counts)): - test_support.run_unittest(ListTest) + support.run_unittest(ListTest) gc.collect() counts[i] = sys.gettotalrefcount() print(counts) Index: Lib/test/test_pep263.py =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: Lib/test/test_quopri.py =================================================================== --- Lib/test/test_quopri.py (revision 62293) +++ Lib/test/test_quopri.py (working copy) @@ -1,4 +1,4 @@ -from test import test_support +from test import support import unittest import sys, os, io, subprocess @@ -199,7 +199,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 62293) +++ 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 62293) +++ 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 as 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(str(test_support.TESTFN.encode("utf-8"), + f1 = os.listdir(support.TESTFN) + f2 = os.listdir(str(support.TESTFN.encode("utf-8"), sys.getfilesystemencoding())) - sf2 = set("\\".join((str(test_support.TESTFN), f)) + sf2 = set("\\".join((str(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,'Gr\xfc\xdf-\u66e8\u66e9\u66eb') + dirname = os.path.join(support.TESTFN,'Gr\xfc\xdf-\u66e8\u66e9\u66eb') filename = '\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 62293) +++ Lib/test/test_doctest2.py (working copy) @@ -12,7 +12,7 @@ """ -from test import test_support +from test import support class C(object): """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_wait3.py =================================================================== --- Lib/test/test_wait3.py (revision 62293) +++ 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_opcodes.py =================================================================== --- Lib/test/test_opcodes.py (revision 62293) +++ 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_pep3131.py =================================================================== --- Lib/test/test_pep3131.py (revision 62293) +++ Lib/test/test_pep3131.py (working copy) @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- import unittest -from test import test_support +from test import support class PEP3131Test(unittest.TestCase): @@ -23,7 +23,7 @@ self.fail("expected exception didn't occur") def test_main(): - test_support.run_unittest(PEP3131Test) + support.run_unittest(PEP3131Test) if __name__=="__main__": test_main() Index: Lib/test/test_setcomps.py =================================================================== --- Lib/test/test_setcomps.py (revision 62293) +++ Lib/test/test_setcomps.py (working copy) @@ -133,16 +133,16 @@ def test_main(verbose=None): import sys - from test import test_support + from test import support from test import test_setcomps - test_support.run_doctest(test_setcomps, verbose) + support.run_doctest(test_setcomps, verbose) # verify reference counting if verbose and hasattr(sys, "gettotalrefcount"): import gc counts = [None] * 5 for i in range(len(counts)): - test_support.run_doctest(test_setcomps, verbose) + support.run_doctest(test_setcomps, verbose) gc.collect() counts[i] = sys.gettotalrefcount() print(counts) Index: Lib/test/test_strftime.py =================================================================== --- Lib/test/test_strftime.py (revision 62293) +++ 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 @@ -68,7 +68,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])) @@ -80,7 +80,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 @@ -162,24 +162,24 @@ except ValueError as 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 62293) +++ 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 62293) +++ 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 62293) +++ 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 @@ -264,7 +264,7 @@ def test_main(): - test_support.run_unittest( + support.run_unittest( TestIsInstanceExceptions, TestIsSubclassExceptions, TestIsInstanceIsSubclass Index: Lib/test/test_raise.py =================================================================== --- Lib/test/test_raise.py (revision 62293) +++ Lib/test/test_raise.py (working copy) @@ -3,7 +3,7 @@ """Tests for the raise statement.""" -from test import test_support +from test import support import sys import types import unittest @@ -156,7 +156,7 @@ def test_main(): - test_support.run_unittest(__name__) + support.run_unittest(__name__) if __name__ == "__main__": Index: Lib/test/test_site.py =================================================================== --- Lib/test/test_site.py (revision 62293) +++ 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 builtins import os import sys Index: Lib/test/test_inspect.py =================================================================== --- Lib/test/test_inspect.py (revision 62293) +++ Lib/test/test_inspect.py (working copy) @@ -6,7 +6,7 @@ import collections from os.path import normcase -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 62293) +++ 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_listcomps.py =================================================================== --- Lib/test/test_listcomps.py (revision 62293) +++ Lib/test/test_listcomps.py (working copy) @@ -130,16 +130,16 @@ def test_main(verbose=None): import sys - from test import test_support + from test import support from test import test_listcomps - test_support.run_doctest(test_listcomps, verbose) + support.run_doctest(test_listcomps, verbose) # verify reference counting if verbose and hasattr(sys, "gettotalrefcount"): import gc counts = [None] * 5 for i in range(len(counts)): - test_support.run_doctest(test_genexps, verbose) + support.run_doctest(test_genexps, verbose) gc.collect() counts[i] = sys.gettotalrefcount() print(counts) @@ -278,16 +278,16 @@ def test_main(verbose=None): import sys - from test import test_support + from test import support from test import test_listcomps - test_support.run_doctest(test_listcomps, verbose) + support.run_doctest(test_listcomps, verbose) # verify reference counting if verbose and hasattr(sys, "gettotalrefcount"): import gc counts = [None] * 5 for i in range(len(counts)): - test_support.run_doctest(test_genexps, verbose) + support.run_doctest(test_genexps, verbose) gc.collect() counts[i] = sys.gettotalrefcount() print(counts) @@ -426,16 +426,16 @@ def test_main(verbose=None): import sys - from test import test_support + from test import support from test import test_listcomps - test_support.run_doctest(test_listcomps, verbose) + support.run_doctest(test_listcomps, verbose) # verify reference counting if verbose and hasattr(sys, "gettotalrefcount"): import gc counts = [None] * 5 for i in range(len(counts)): - test_support.run_doctest(test_listcomps, verbose) + support.run_doctest(test_listcomps, verbose) gc.collect() counts[i] = sys.gettotalrefcount() print(counts) Index: Lib/test/test_contains.py =================================================================== --- Lib/test/test_contains.py (revision 62293) +++ Lib/test/test_contains.py (working copy) @@ -1,4 +1,4 @@ -from test.test_support import run_unittest +from test.support import run_unittest import unittest Index: Lib/test/test_array.py =================================================================== --- Lib/test/test_array.py (revision 62293) +++ 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, io, math from pickle import loads, dumps @@ -162,12 +162,12 @@ def test_tofromfile(self): a = array.array(self.typecode, 2*self.example) self.assertRaises(TypeError, a.tofile) - f = open(test_support.TESTFN, 'wb') + 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) b.fromfile(f, len(self.example)) self.assertEqual(b, array.array(self.typecode, self.example)) @@ -179,7 +179,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) @@ -966,14 +966,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 range(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 62293) +++ 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 62293) +++ 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__': Index: Lib/test/test_codecmaps_hk.py =================================================================== --- Lib/test/test_codecmaps_hk.py (revision 62293) +++ 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 62293) +++ 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 62293) +++ 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. @@ -270,7 +270,7 @@ def test_main(): - test_support.run_unittest(__name__) + support.run_unittest(__name__) if __name__ == "__main__": Index: Lib/test/test_itertools.py =================================================================== --- Lib/test/test_itertools.py (revision 62293) +++ Lib/test/test_itertools.py (working copy) @@ -1,12 +1,12 @@ import unittest -from test import test_support +from test import support from itertools import * from weakref import proxy import sys import operator import random from functools import reduce -maxsize = test_support.MAX_Py_ssize_t +maxsize = support.MAX_Py_ssize_t minsize = -maxsize-1 def lzip(*args): @@ -1391,20 +1391,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 range(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 62293) +++ 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 62293) +++ 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): @@ -69,7 +69,7 @@ def test_main(): - test_support.run_unittest( + support.run_unittest( LockTests, ImportTests, ) Index: Lib/test/test_unicode.py =================================================================== --- Lib/test/test_unicode.py (revision 62293) +++ Lib/test/test_unicode.py (working copy) @@ -11,7 +11,7 @@ import sys import unittest import warnings -from test import test_support, string_tests +from test import support, string_tests # Error handling (bad decoder return) def search_function(encoding): @@ -671,7 +671,7 @@ return '\u1234' self.assertEqual('%s' % Wrapper(), '\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('1.0', '%.1f' % 1.0) @@ -1077,7 +1077,7 @@ 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 62293) +++ 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(b"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 62293) +++ 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 = b'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() @@ -898,7 +898,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)) @@ -1145,7 +1145,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 @@ -1229,9 +1229,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 62293) +++ 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(b"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(b"foo") f.close() - f = open(test_support.TESTFN, "ab") + f = open(support.TESTFN, "ab") f.write(b"bar") f.close() - f = open(test_support.TESTFN, "rb") + f = open(support.TESTFN, "rb") d = f.read() f.close() self.assertEqual(d, b"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(b"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(b"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(b"foo") f.close() - self.assertIs(genericpath.isfile(test_support.TESTFN), True) - os.remove(test_support.TESTFN) - os.mkdir(test_support.TESTFN) - self.assertIs(genericpath.isfile(test_support.TESTFN), False) - os.rmdir(test_support.TESTFN) + self.assertIs(genericpath.isfile(support.TESTFN), True) + os.remove(support.TESTFN) + os.mkdir(support.TESTFN) + self.assertIs(genericpath.isfile(support.TESTFN), False) + os.rmdir(support.TESTFN) finally: if not f.close(): f.close() try: - os.remove(test_support.TESTFN) + os.remove(support.TESTFN) except os.error: pass try: - os.rmdir(test_support.TESTFN) + os.rmdir(support.TESTFN) except os.error: pass self.assertRaises(TypeError, genericpath.isdir) def test_samefile(self): - f = open(test_support.TESTFN + "1", "wb") + f = open(support.TESTFN + "1", "wb") try: f.write(b"foo") f.close() self.assertIs( genericpath.samefile( - test_support.TESTFN + "1", - test_support.TESTFN + "1" + support.TESTFN + "1", + support.TESTFN + "1" ), True ) @@ -142,24 +142,24 @@ # inode information and thus, that samefile() doesn't work if hasattr(os, "symlink"): os.symlink( - test_support.TESTFN + "1", - test_support.TESTFN + "2" + support.TESTFN + "1", + support.TESTFN + "2" ) self.assertIs( genericpath.samefile( - test_support.TESTFN + "1", - test_support.TESTFN + "2" + support.TESTFN + "1", + support.TESTFN + "2" ), True ) - os.remove(test_support.TESTFN + "2") - f = open(test_support.TESTFN + "2", "wb") + os.remove(support.TESTFN + "2") + f = open(support.TESTFN + "2", "wb") f.write(b"bar") f.close() self.assertIs( genericpath.samefile( - test_support.TESTFN + "1", - test_support.TESTFN + "2" + support.TESTFN + "1", + support.TESTFN + "2" ), False ) @@ -167,18 +167,18 @@ if not f.close(): f.close() try: - os.remove(test_support.TESTFN + "1") + os.remove(support.TESTFN + "1") except os.error: pass try: - os.remove(test_support.TESTFN + "2") + os.remove(support.TESTFN + "2") except os.error: pass self.assertRaises(TypeError, genericpath.samefile) def test_main(): - test_support.run_unittest(AllCommonTest) + support.run_unittest(AllCommonTest) if __name__=="__main__": test_main() Index: Lib/test/test_uu.py =================================================================== --- Lib/test/test_uu.py (revision 62293) +++ Lib/test/test_uu.py (working copy) @@ -4,7 +4,7 @@ """ import unittest -from test import test_support +from test import support import sys, os import uu @@ -111,8 +111,8 @@ pass def setUp(self): - self.tmpin = test_support.TESTFN + "i" - self.tmpout = test_support.TESTFN + "o" + self.tmpin = support.TESTFN + "i" + self.tmpout = support.TESTFN + "o" def tearDown(self): del self.tmpin @@ -183,7 +183,7 @@ self._kill(f) def test_main(): - test_support.run_unittest(UUTest, + support.run_unittest(UUTest, UUStdIOTest, UUFileTest, ) Index: Lib/test/test_docxmlrpc.py =================================================================== --- Lib/test/test_docxmlrpc.py (revision 62293) +++ Lib/test/test_docxmlrpc.py (working copy) @@ -1,6 +1,6 @@ from DocXMLRPCServer import DocXMLRPCServer import httplib -from test import test_support +from test import support import threading import time import unittest @@ -145,7 +145,7 @@ response.read()) def test_main(): - test_support.run_unittest(DocXMLRPCHTTPGETServer) + support.run_unittest(DocXMLRPCHTTPGETServer) if __name__ == '__main__': test_main() Index: Lib/test/test_atexit.py =================================================================== --- Lib/test/test_atexit.py (revision 62293) +++ Lib/test/test_atexit.py (working copy) @@ -2,7 +2,7 @@ import unittest import io import atexit -from test import test_support +from test import support ### helpers def h1(): @@ -109,7 +109,7 @@ def test_main(): - test_support.run_unittest(TestCase) + support.run_unittest(TestCase) if __name__ == "__main__": test_main() Index: Lib/test/test_fileinput.py =================================================================== --- Lib/test/test_fileinput.py (revision 62293) +++ Lib/test/test_fileinput.py (working copy) @@ -4,8 +4,8 @@ ''' import unittest -from test.test_support import verbose, TESTFN, run_unittest -from test.test_support import unlink as safe_unlink +from test.support import verbose, TESTFN, run_unittest +from test.support import unlink as safe_unlink import sys, re from io import StringIO from fileinput import FileInput, hook_encoded Index: Lib/test/test_getopt.py =================================================================== --- Lib/test/test_getopt.py (revision 62293) +++ Lib/test/test_getopt.py (working copy) @@ -1,7 +1,7 @@ # test_getopt.py # David Goodger 2000-08-19 -from test.test_support import verbose, run_doctest, run_unittest +from test.support import verbose, run_doctest, run_unittest import unittest import getopt Index: Lib/test/test_applesingle.py =================================================================== --- Lib/test/test_applesingle.py (revision 62293) +++ Lib/test/test_applesingle.py (working copy) @@ -5,7 +5,7 @@ import Carbon.File import MacOS import os -from test import test_support +from test import support import struct import applesingle @@ -19,18 +19,18 @@ 2, 50+len(dataforkdata), len(resourceforkdata)) + \ dataforkdata + \ resourceforkdata -TESTFN2 = test_support.TESTFN + '2' +TESTFN2 = support.TESTFN + '2' class TestApplesingle(unittest.TestCase): def setUp(self): - fp = open(test_support.TESTFN, 'wb') + fp = open(support.TESTFN, 'wb') fp.write(applesingledata) fp.close() def tearDown(self): try: - os.unlink(test_support.TESTFN) + os.unlink(support.TESTFN) except: pass try: @@ -51,7 +51,7 @@ os.unlink(TESTFN2) except: pass - applesingle.decode(test_support.TESTFN, TESTFN2) + applesingle.decode(support.TESTFN, TESTFN2) self.compareData(False, dataforkdata) self.compareData(True, resourceforkdata) @@ -60,11 +60,11 @@ os.unlink(TESTFN2) except: pass - applesingle.decode(test_support.TESTFN, TESTFN2, resonly=True) + applesingle.decode(support.TESTFN, TESTFN2, resonly=True) self.compareData(False, resourceforkdata) def test_main(): - test_support.run_unittest(TestApplesingle) + support.run_unittest(TestApplesingle) if __name__ == '__main__': Index: Lib/test/test_cProfile.py =================================================================== --- Lib/test/test_cProfile.py (revision 62293) +++ Lib/test/test_cProfile.py (working copy) @@ -121,7 +121,7 @@ def test_main(): - from test.test_support import TestSkipped + from test.support import TestSkipped raise TestSkipped('test_cProfile test is current broken') Index: Lib/test/test_pow.py =================================================================== --- Lib/test/test_pow.py (revision 62293) +++ Lib/test/test_pow.py (working copy) @@ -1,4 +1,4 @@ -import test.test_support, unittest +import test.support, unittest class PowTest(unittest.TestCase): @@ -123,7 +123,7 @@ eq(expected, 1.0) # else we didn't push fiveto to evenness def test_main(): - test.test_support.run_unittest(PowTest) + test.support.run_unittest(PowTest) if __name__ == "__main__": test_main() Index: Lib/test/test_float.py =================================================================== --- Lib/test/test_float.py (revision 62293) +++ Lib/test/test_float.py (working copy) @@ -1,7 +1,7 @@ import unittest, struct import os -from test import test_support +from test import support def isinf(x): return x * 0.5 == x @@ -240,7 +240,7 @@ self.assertEqual(str(-1e300 * 1e300 * 0), "nan") def test_main(): - test_support.run_unittest( + support.run_unittest( FormatFunctionsTestCase, UnknownFormatTestCase, IEEEFormatTestCase, Index: Lib/test/test_int_literal.py =================================================================== --- Lib/test/test_int_literal.py (revision 62293) +++ Lib/test/test_int_literal.py (working copy) @@ -4,7 +4,7 @@ """ import unittest -from test import test_support +from test import support class TestHexOctBin(unittest.TestCase): @@ -141,7 +141,7 @@ self.assertEqual(-0b1111111111111111111111111111111111111111111111111111111111111111, -18446744073709551615) def test_main(): - test_support.run_unittest(TestHexOctBin) + support.run_unittest(TestHexOctBin) if __name__ == "__main__": test_main() Index: Lib/test/test_string.py =================================================================== --- Lib/test/test_string.py (revision 62293) +++ Lib/test/test_string.py (working copy) @@ -1,5 +1,5 @@ import unittest, string -from test import test_support +from test import support class ModuleTest(unittest.TestCase): @@ -110,7 +110,7 @@ self.assertRaises(TypeError, string.maketrans, 'abc', 'def') def test_main(): - test_support.run_unittest(ModuleTest) + support.run_unittest(ModuleTest) if __name__ == "__main__": test_main() Index: Lib/test/test_poll.py =================================================================== --- Lib/test/test_poll.py (revision 62293) +++ Lib/test/test_poll.py (working copy) @@ -1,7 +1,7 @@ # Test case for the os.poll() function import os, select, random, unittest -from test.test_support import TestSkipped, TESTFN, run_unittest +from test.support import TestSkipped, TESTFN, run_unittest try: select.poll Index: Lib/test/test_shutil.py =================================================================== --- Lib/test/test_shutil.py (revision 62293) +++ Lib/test/test_shutil.py (working copy) @@ -7,8 +7,8 @@ import stat import os import os.path -from test import test_support -from test.test_support import TESTFN +from test import support +from test.support import TESTFN class TestShutil(unittest.TestCase): def test_rmtree_errors(self): @@ -267,7 +267,7 @@ def test_main(): - test_support.run_unittest(TestShutil, TestMove) + support.run_unittest(TestShutil, TestMove) if __name__ == '__main__': test_main() Index: Lib/test/test_genexps.py =================================================================== --- Lib/test/test_genexps.py (revision 62293) +++ Lib/test/test_genexps.py (working copy) @@ -262,16 +262,16 @@ def test_main(verbose=None): import sys - from test import test_support + from test import support from test import test_genexps - test_support.run_doctest(test_genexps, verbose) + support.run_doctest(test_genexps, verbose) # verify reference counting if verbose and hasattr(sys, "gettotalrefcount"): import gc counts = [None] * 5 for i in range(len(counts)): - test_support.run_doctest(test_genexps, verbose) + support.run_doctest(test_genexps, verbose) gc.collect() counts[i] = sys.gettotalrefcount() print(counts) Index: Lib/test/test_with.py =================================================================== --- Lib/test/test_with.py (revision 62293) +++ Lib/test/test_with.py (working copy) @@ -11,7 +11,7 @@ import unittest from collections import deque from contextlib import GeneratorContextManager, contextmanager -from test.test_support import run_unittest +from test.support import run_unittest class MockContextManager(GeneratorContextManager): Index: Lib/test/test_metaclass.py =================================================================== --- Lib/test/test_metaclass.py (revision 62293) +++ Lib/test/test_metaclass.py (working copy) @@ -235,9 +235,9 @@ __test__ = {'doctests' : doctests} def test_main(verbose=False): - from test import test_support + from test import support from test import test_metaclass - test_support.run_doctest(test_metaclass, verbose) + support.run_doctest(test_metaclass, verbose) if __name__ == "__main__": test_main(verbose=True) Index: Lib/test/test_file.py =================================================================== --- Lib/test/test_file.py (revision 62293) +++ Lib/test/test_file.py (working copy) @@ -4,7 +4,7 @@ from array import array from weakref import proxy -from test.test_support import TESTFN, findfile, run_unittest +from test.support import TESTFN, findfile, run_unittest from collections import UserList class AutoFileTests(unittest.TestCase): Index: Lib/test/test_shlex.py =================================================================== --- Lib/test/test_shlex.py (revision 62293) +++ Lib/test/test_shlex.py (working copy) @@ -3,7 +3,7 @@ import os, sys, io import shlex -from test import test_support +from test import support # The original test data set was from shellwords, by Hartmut Goebel. @@ -181,7 +181,7 @@ delattr(ShlexTest, methname) def test_main(): - test_support.run_unittest(ShlexTest) + support.run_unittest(ShlexTest) if __name__ == "__main__": test_main() Index: Lib/test/test_logging.py =================================================================== --- Lib/test/test_logging.py (revision 62293) +++ Lib/test/test_logging.py (working copy) @@ -38,7 +38,7 @@ import struct import sys import tempfile -from test.test_support import captured_stdout, run_with_locale, run_unittest +from test.support import captured_stdout, run_with_locale, run_unittest import textwrap import threading import time Index: Lib/test/test_email.py =================================================================== --- Lib/test/test_email.py (revision 62293) +++ Lib/test/test_email.py (working copy) @@ -3,10 +3,10 @@ # The specific tests now live in Lib/email/test from email.test.test_email import suite -from test import test_support +from test import support def test_main(): - test_support.run_unittest(suite()) + support.run_unittest(suite()) if __name__ == '__main__': test_main() Index: Lib/test/test_threadsignals.py =================================================================== --- Lib/test/test_threadsignals.py (revision 62293) +++ Lib/test/test_threadsignals.py (working copy) @@ -5,7 +5,7 @@ import signal import os import sys -from test.test_support import run_unittest, TestSkipped +from test.support import run_unittest, TestSkipped if sys.platform[:3] in ('win', 'os2'): raise TestSkipped("Can't test signal on %s" % sys.platform) Index: Lib/test/test_gc.py =================================================================== --- Lib/test/test_gc.py (revision 62293) +++ Lib/test/test_gc.py (working copy) @@ -1,5 +1,5 @@ import unittest -from test.test_support import verbose, run_unittest +from test.support import verbose, run_unittest import sys import gc import weakref Index: Lib/test/test_codecmaps_kr.py =================================================================== --- Lib/test/test_codecmaps_kr.py (revision 62293) +++ Lib/test/test_codecmaps_kr.py (working copy) @@ -4,7 +4,7 @@ # Codec mapping tests for ROK encodings # -from test import test_support +from test import support from test import test_multibytecodec_support import unittest @@ -38,7 +38,7 @@ pass_dectest = [(b'\\', '\u20a9')] def test_main(): - test_support.run_unittest(__name__) + support.run_unittest(__name__) if __name__ == "__main__": test_main() Index: Lib/test/test_pyclbr.py =================================================================== --- Lib/test/test_pyclbr.py (revision 62293) +++ Lib/test/test_pyclbr.py (working copy) @@ -2,7 +2,7 @@ Test cases for pyclbr.py Nick Mathewson ''' -from test.test_support import run_unittest +from test.support import run_unittest import sys from types import FunctionType, MethodType, BuiltinFunctionType import pyclbr Index: Lib/test/test_print.py =================================================================== --- Lib/test/test_print.py (revision 62293) +++ Lib/test/test_print.py (working copy) @@ -6,7 +6,7 @@ from __future__ import print_function import unittest -from test import test_support +from test import support import sys try: @@ -62,7 +62,7 @@ end is not NotDefined, file is not NotDefined)] - with test_support.captured_stdout() as t: + with support.captured_stdout() as t: fn(args, sep, end, file) self.assertEqual(t.getvalue(), expected) @@ -113,7 +113,7 @@ self.assertRaises(AttributeError, print, '', file='') def test_main(): - test_support.run_unittest(TestPrint) + support.run_unittest(TestPrint) if __name__ == "__main__": test_main() Index: Lib/test/test_super.py =================================================================== --- Lib/test/test_super.py (revision 62293) +++ Lib/test/test_super.py (working copy) @@ -2,7 +2,7 @@ import sys import unittest -from test import test_support +from test import support class A: @@ -72,7 +72,7 @@ def test_main(): - test_support.run_unittest(TestSuper) + support.run_unittest(TestSuper) if __name__ == "__main__": Index: Lib/test/test_StringIO.py =================================================================== --- Lib/test/test_StringIO.py (revision 62293) +++ Lib/test/test_StringIO.py (working copy) @@ -3,7 +3,7 @@ import sys import unittest import io -from test import test_support +from test import support class TestGenericStringIO: @@ -103,7 +103,7 @@ def test_unicode(self): - if not test_support.have_unicode: return + if not support.have_unicode: return # The StringIO module also supports concatenating Unicode # snippets to larger Unicode strings. This is tested by this @@ -120,7 +120,7 @@ def test_main(): - test_support.run_unittest(TestioStringIO) + support.run_unittest(TestioStringIO) if __name__ == '__main__': Index: Lib/test/test_heapq.py =================================================================== --- Lib/test/test_heapq.py (revision 62293) +++ Lib/test/test_heapq.py (working copy) @@ -2,7 +2,7 @@ import random import unittest -from test import test_support +from test import support import sys # We do a bit of trickery here to be able to test both the C implementation @@ -353,14 +353,14 @@ from types import BuiltinFunctionType test_classes = [TestHeapPython, TestHeapC, TestErrorHandling] - test_support.run_unittest(*test_classes) + support.run_unittest(*test_classes) # verify reference counting if verbose and hasattr(sys, "gettotalrefcount"): import gc counts = [None] * 5 for i in range(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_long.py =================================================================== --- Lib/test/test_long.py (revision 62293) +++ Lib/test/test_long.py (working copy) @@ -1,5 +1,5 @@ import unittest -from test import test_support +from test import support import random @@ -553,7 +553,7 @@ self.assertRaises(OverflowError, int, float('nan')) def test_main(): - test_support.run_unittest(LongTest) + support.run_unittest(LongTest) if __name__ == "__main__": test_main() Index: Lib/test/test_profile.py =================================================================== --- Lib/test/test_profile.py (revision 62293) +++ Lib/test/test_profile.py (working copy) @@ -6,7 +6,7 @@ import unittest from difflib import unified_diff from io import StringIO -from test.test_support import run_unittest +from test.support import run_unittest import profile from test.profilee import testfunc, timer Index: Lib/test/test_typechecks.py =================================================================== --- Lib/test/test_typechecks.py (revision 62293) +++ Lib/test/test_typechecks.py (working copy) @@ -1,7 +1,7 @@ """Unit tests for __instancecheck__ and __subclasscheck__.""" import unittest -from test import test_support +from test import support class ABC(type): @@ -56,7 +56,7 @@ def test_main(): - test_support.run_unittest(TypeChecksTest) + support.run_unittest(TypeChecksTest) if __name__ == "__main__": Index: Lib/test/test_dbm.py =================================================================== --- Lib/test/test_dbm.py (revision 62293) +++ Lib/test/test_dbm.py (working copy) @@ -1,4 +1,4 @@ -from test import test_support +from test import support import unittest import os import random @@ -8,13 +8,13 @@ class DbmTestCase(unittest.TestCase): def setUp(self): - self.filename = test_support.TESTFN + self.filename = support.TESTFN self.d = dbm.open(self.filename, 'c') self.d.close() def tearDown(self): for suffix in ['', '.pag', '.dir', '.db']: - test_support.unlink(self.filename + suffix) + support.unlink(self.filename + suffix) def test_keys(self): self.d = dbm.open(self.filename, 'c') @@ -34,7 +34,7 @@ self.fail() def test_main(): - test_support.run_unittest(DbmTestCase) + support.run_unittest(DbmTestCase) if __name__ == '__main__': test_main() Index: Lib/test/test___future__.py =================================================================== --- Lib/test/test___future__.py (revision 62293) +++ Lib/test/test___future__.py (working copy) @@ -1,6 +1,6 @@ #! /usr/bin/env python import unittest -from test import test_support +from test import support import __future__ GOOD_SERIALS = ("alpha", "beta", "candidate", "final") @@ -57,7 +57,7 @@ ".compiler_flag isn't int") def test_main(): - test_support.run_unittest(FutureTest) + support.run_unittest(FutureTest) if __name__ == "__main__": test_main() Index: Lib/test/test_charmapcodec.py =================================================================== --- Lib/test/test_charmapcodec.py (revision 62293) +++ Lib/test/test_charmapcodec.py (working copy) @@ -9,7 +9,7 @@ """#" -import test.test_support, unittest +import test.support, unittest import codecs @@ -50,7 +50,7 @@ self.assertRaises(UnicodeError, str, b'abc\001', codecname) def test_main(): - test.test_support.run_unittest(CharmapCodecTest) + test.support.run_unittest(CharmapCodecTest) if __name__ == "__main__": test_main() Index: Lib/test/test_gzip.py =================================================================== --- Lib/test/test_gzip.py (revision 62293) +++ Lib/test/test_gzip.py (working copy) @@ -3,7 +3,7 @@ """ import unittest -from test import test_support +from test import support import os import gzip @@ -22,13 +22,13 @@ class TestGzip(unittest.TestCase): - filename = test_support.TESTFN + filename = support.TESTFN def setUp (self): - test_support.unlink(self.filename) + support.unlink(self.filename) def tearDown (self): - test_support.unlink(self.filename) + support.unlink(self.filename) def test_write (self): @@ -158,7 +158,7 @@ f.close() def test_main(verbose=None): - test_support.run_unittest(TestGzip) + support.run_unittest(TestGzip) if __name__ == "__main__": test_main(verbose=True) Index: Lib/test/test_cmd_line.py =================================================================== --- Lib/test/test_cmd_line.py (revision 62293) +++ Lib/test/test_cmd_line.py (working copy) @@ -2,7 +2,7 @@ # All tests are executed with environment variables ignored # See test_cmd_line_script.py for testing of script execution -import test.test_support, unittest +import test.support, unittest import sys import subprocess @@ -123,8 +123,8 @@ def test_main(): - test.test_support.run_unittest(CmdLineTest) - test.test_support.reap_children() + test.support.run_unittest(CmdLineTest) + test.support.reap_children() if __name__ == "__main__": test_main() Index: Lib/test/test_future.py =================================================================== --- Lib/test/test_future.py (revision 62293) +++ Lib/test/test_future.py (working copy) @@ -1,7 +1,7 @@ # Test various flavors of legal and illegal future statements import unittest -from test import test_support +from test import support import re rx = re.compile('\((\S+).py, line (\d+)') @@ -13,17 +13,17 @@ class FutureTest(unittest.TestCase): def test_future1(self): - test_support.unload('test_future1') + support.unload('test_future1') from test import test_future1 self.assertEqual(test_future1.result, 6) def test_future2(self): - test_support.unload('test_future2') + support.unload('test_future2') from test import test_future2 self.assertEqual(test_future2.result, 6) def test_future3(self): - test_support.unload('test_future3') + support.unload('test_future3') from test import test_future3 def test_badfuture3(self): @@ -104,7 +104,7 @@ def test_main(): - test_support.run_unittest(FutureTest) + support.run_unittest(FutureTest) if __name__ == "__main__": test_main() Index: Lib/test/test_functools.py =================================================================== --- Lib/test/test_functools.py (revision 62293) +++ Lib/test/test_functools.py (working copy) @@ -1,6 +1,6 @@ import functools import unittest -from test import test_support +from test import support from weakref import proxy @staticmethod @@ -347,14 +347,14 @@ TestWraps, TestReduce ) - 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 range(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_longexp.py =================================================================== --- Lib/test/test_longexp.py (revision 62293) +++ Lib/test/test_longexp.py (working copy) @@ -1,5 +1,5 @@ import unittest -from test import test_support +from test import support class LongExpText(unittest.TestCase): def test_longexp(self): @@ -8,7 +8,7 @@ self.assertEqual(len(l), REPS) def test_main(): - test_support.run_unittest(LongExpText) + support.run_unittest(LongExpText) if __name__=="__main__": test_main() Index: Lib/test/test_runpy.py =================================================================== --- Lib/test/test_runpy.py (revision 62293) +++ Lib/test/test_runpy.py (working copy) @@ -4,7 +4,7 @@ import os.path import sys import tempfile -from test.test_support import verbose, run_unittest, forget +from test.support import verbose, run_unittest, forget from runpy import _run_code, _run_module_code, run_module # Note: This module can't safely test _run_module_as_main as it Index: Lib/test/test_colorsys.py =================================================================== --- Lib/test/test_colorsys.py (revision 62293) +++ Lib/test/test_colorsys.py (working copy) @@ -1,4 +1,4 @@ -import unittest, test.test_support +import unittest, test.support import colorsys def frange(start, stop, step): @@ -70,7 +70,7 @@ self.assertTripleEqual(rgb, colorsys.hls_to_rgb(*hls)) def test_main(): - test.test_support.run_unittest(ColorsysTest) + test.support.run_unittest(ColorsysTest) if __name__ == "__main__": test_main() Index: Lib/test/test_pstats.py =================================================================== --- Lib/test/test_pstats.py (revision 62293) +++ Lib/test/test_pstats.py (working copy) @@ -1,5 +1,5 @@ import unittest -from test import test_support +from test import support import pstats @@ -17,7 +17,7 @@ def test_main(): - test_support.run_unittest( + support.run_unittest( AddCallersTestCase ) Index: Lib/test/test_unpack.py =================================================================== --- Lib/test/test_unpack.py (revision 62293) +++ Lib/test/test_unpack.py (working copy) @@ -122,9 +122,9 @@ __test__ = {'doctests' : doctests} def test_main(verbose=False): - from test import test_support + from test import support from test import test_unpack - test_support.run_doctest(test_unpack, verbose) + support.run_doctest(test_unpack, verbose) if __name__ == "__main__": test_main(verbose=True) Index: Lib/test/test_os.py =================================================================== --- Lib/test/test_os.py (revision 62293) +++ Lib/test/test_os.py (working copy) @@ -6,22 +6,22 @@ import unittest import warnings import sys -from test import test_support +from test import support # Tests creating TESTFN class FileTests(unittest.TestCase): def setUp(self): - if os.path.exists(test_support.TESTFN): - os.unlink(test_support.TESTFN) + if os.path.exists(support.TESTFN): + os.unlink(support.TESTFN) tearDown = setUp def test_access(self): - f = os.open(test_support.TESTFN, os.O_CREAT|os.O_RDWR) + f = os.open(support.TESTFN, os.O_CREAT|os.O_RDWR) os.close(f) - self.assert_(os.access(test_support.TESTFN, os.W_OK)) + self.assert_(os.access(support.TESTFN, os.W_OK)) def test_closerange(self): - f = os.open(test_support.TESTFN, os.O_CREAT|os.O_RDWR) + f = os.open(support.TESTFN, os.O_CREAT|os.O_RDWR) # close a fd that is open, and one that isn't os.closerange(f, f+2) self.assertRaises(OSError, os.write, f, "a") @@ -29,12 +29,12 @@ class TemporaryFileTests(unittest.TestCase): def setUp(self): self.files = [] - os.mkdir(test_support.TESTFN) + os.mkdir(support.TESTFN) def tearDown(self): for name in self.files: os.unlink(name) - os.rmdir(test_support.TESTFN) + os.rmdir(support.TESTFN) def check_tempfile(self, name): # make sure it doesn't already exist: @@ -51,10 +51,10 @@ r"test_os$") self.check_tempfile(os.tempnam()) - name = os.tempnam(test_support.TESTFN) + name = os.tempnam(support.TESTFN) self.check_tempfile(name) - name = os.tempnam(test_support.TESTFN, "pfx") + name = os.tempnam(support.TESTFN, "pfx") self.assert_(os.path.basename(name)[:3] == "pfx") self.check_tempfile(name) @@ -137,15 +137,15 @@ # Test attributes on return values from os.*stat* family. class StatAttributeTests(unittest.TestCase): def setUp(self): - os.mkdir(test_support.TESTFN) - self.fname = os.path.join(test_support.TESTFN, "f1") + os.mkdir(support.TESTFN) + self.fname = os.path.join(support.TESTFN, "f1") f = open(self.fname, 'wb') f.write(b"ABC") f.close() def tearDown(self): os.unlink(self.fname) - os.rmdir(test_support.TESTFN) + os.rmdir(support.TESTFN) def test_stat_attributes(self): if not hasattr(os, "stat"): @@ -265,11 +265,11 @@ def test_utime_dir(self): delta = 1000000 - st = os.stat(test_support.TESTFN) + st = os.stat(support.TESTFN) # round to int, because some systems may support sub-second # time stamps in stat, but not in utime. - os.utime(test_support.TESTFN, (st.st_atime, int(st.st_mtime-delta))) - st2 = os.stat(test_support.TESTFN) + os.utime(support.TESTFN, (st.st_atime, int(st.st_mtime-delta))) + st2 = os.stat(support.TESTFN) self.assertEquals(st2.st_mtime, int(st.st_mtime-delta)) # Restrict test to Win32, since there is no guarantee other @@ -284,7 +284,7 @@ if kernel32.GetVolumeInformationA(root, None, 0, None, None, None, buf, len(buf)): return buf.value - if get_file_system(test_support.TESTFN) == "NTFS": + if get_file_system(support.TESTFN) == "NTFS": def test_1565150(self): t1 = 1159195039.25 os.utime(self.fname, (t1, t1)) @@ -368,7 +368,7 @@ # link/ a symlink to TESTFN.2 # TEST2/ # tmp4 a lone file - walk_path = join(test_support.TESTFN, "TEST1") + walk_path = join(support.TESTFN, "TEST1") sub1_path = join(walk_path, "SUB1") sub11_path = join(sub1_path, "SUB11") sub2_path = join(walk_path, "SUB2") @@ -376,8 +376,8 @@ tmp2_path = join(sub1_path, "tmp2") tmp3_path = join(sub2_path, "tmp3") link_path = join(sub2_path, "link") - t2_path = join(test_support.TESTFN, "TEST2") - tmp4_path = join(test_support.TESTFN, "TEST2", "tmp4") + t2_path = join(support.TESTFN, "TEST2") + tmp4_path = join(support.TESTFN, "TEST2", "tmp4") # Create stuff. os.makedirs(sub11_path) @@ -446,7 +446,7 @@ # Windows, which doesn't have a recursive delete command. The # (not so) subtlety is that rmdir will fail unless the dir's # kids are removed first, so bottom up is essential. - for root, dirs, files in os.walk(test_support.TESTFN, topdown=False): + for root, dirs, files in os.walk(support.TESTFN, topdown=False): for name in files: os.remove(os.path.join(root, name)) for name in dirs: @@ -455,14 +455,14 @@ os.rmdir(dirname) else: os.remove(dirname) - os.rmdir(test_support.TESTFN) + os.rmdir(support.TESTFN) class MakedirTests(unittest.TestCase): def setUp(self): - os.mkdir(test_support.TESTFN) + os.mkdir(support.TESTFN) def test_makedir(self): - base = test_support.TESTFN + base = support.TESTFN path = os.path.join(base, 'dir1', 'dir2', 'dir3') os.makedirs(path) # Should work path = os.path.join(base, 'dir1', 'dir2', 'dir3', 'dir4') @@ -477,12 +477,12 @@ os.makedirs(path) def tearDown(self): - path = os.path.join(test_support.TESTFN, 'dir1', 'dir2', 'dir3', + path = os.path.join(support.TESTFN, 'dir1', 'dir2', 'dir3', 'dir4', 'dir5', 'dir6') # If the tests failed, the bottom-most directory ('../dir6') # may not have been created, so we look for the outermost directory # that exists. - while not os.path.exists(path) and path != test_support.TESTFN: + while not os.path.exists(path) and path != support.TESTFN: path = os.path.dirname(path) os.removedirs(path) @@ -515,32 +515,32 @@ class Win32ErrorTests(unittest.TestCase): def test_rename(self): - self.assertRaises(WindowsError, os.rename, test_support.TESTFN, test_support.TESTFN+".bak") + self.assertRaises(WindowsError, os.rename, support.TESTFN, support.TESTFN+".bak") def test_remove(self): - self.assertRaises(WindowsError, os.remove, test_support.TESTFN) + self.assertRaises(WindowsError, os.remove, support.TESTFN) def test_chdir(self): - self.assertRaises(WindowsError, os.chdir, test_support.TESTFN) + self.assertRaises(WindowsError, os.chdir, support.TESTFN) def test_mkdir(self): - self.assertRaises(WindowsError, os.chdir, test_support.TESTFN) + self.assertRaises(WindowsError, os.chdir, support.TESTFN) def test_utime(self): - self.assertRaises(WindowsError, os.utime, test_support.TESTFN, None) + self.assertRaises(WindowsError, os.utime, support.TESTFN, None) def test_access(self): - self.assertRaises(WindowsError, os.utime, test_support.TESTFN, 0) + self.assertRaises(WindowsError, os.utime, support.TESTFN, 0) def test_chmod(self): - self.assertRaises(WindowsError, os.utime, test_support.TESTFN, 0) + self.assertRaises(WindowsError, os.utime, support.TESTFN, 0) if sys.platform != 'win32': class Win32ErrorTests(unittest.TestCase): pass def test_main(): - test_support.run_unittest( + support.run_unittest( FileTests, StatAttributeTests, EnvironTests, Index: Lib/test/test_plistlib.py =================================================================== --- Lib/test/test_plistlib.py (revision 62293) +++ Lib/test/test_plistlib.py (working copy) @@ -4,7 +4,7 @@ import plistlib import os import datetime -from test import test_support +from test import support # This test data was generated through Cocoa's NSDictionary class @@ -91,7 +91,7 @@ def tearDown(self): try: - os.unlink(test_support.TESTFN) + os.unlink(support.TESTFN) except: pass @@ -123,8 +123,8 @@ def test_io(self): pl = self._create() - plistlib.writePlist(pl, test_support.TESTFN) - pl2 = plistlib.readPlist(test_support.TESTFN) + plistlib.writePlist(pl, support.TESTFN) + pl2 = plistlib.readPlist(support.TESTFN) self.assertEqual(dict(pl), dict(pl2)) def test_bytes(self): @@ -177,7 +177,7 @@ def test_main(): - test_support.run_unittest(TestPlistlib) + support.run_unittest(TestPlistlib) if __name__ == '__main__': Index: Lib/test/test_aepack.py =================================================================== --- Lib/test/test_aepack.py (revision 62293) +++ Lib/test/test_aepack.py (working copy) @@ -4,7 +4,7 @@ import aepack import aetypes import os -from test import test_support +from test import support class TestAepack(unittest.TestCase): OBJECTS = [ @@ -77,7 +77,7 @@ def test_main(): - test_support.run_unittest(TestAepack) + support.run_unittest(TestAepack) if __name__ == '__main__': Index: Lib/test/test_errno.py =================================================================== --- Lib/test/test_errno.py (revision 62293) +++ Lib/test/test_errno.py (working copy) @@ -4,7 +4,7 @@ """ import errno -from test import test_support +from test import support import unittest std_c_errors = frozenset(['EDOM', 'ERANGE']) @@ -33,7 +33,7 @@ def test_main(): - test_support.run_unittest(ErrnoAttributeTests, ErrorcodeTests) + support.run_unittest(ErrnoAttributeTests, ErrorcodeTests) if __name__ == '__main__': Index: Lib/test/test_tarfile.py =================================================================== --- Lib/test/test_tarfile.py (revision 62293) +++ Lib/test/test_tarfile.py (working copy) @@ -10,7 +10,7 @@ import unittest import tarfile -from test import test_support +from test import support # Check for our compression modules. try: @@ -27,7 +27,7 @@ return md5(data).hexdigest() def path(path): - return test_support.findfile(path) + return support.findfile(path) TEMPDIR = os.path.join(tempfile.gettempdir(), "test_tarfile_tmp") tarname = path("testtar.tar") @@ -1171,7 +1171,7 @@ ] try: - test_support.run_unittest(*tests) + support.run_unittest(*tests) finally: if os.path.exists(TEMPDIR): shutil.rmtree(TEMPDIR) Index: Lib/test/test_syntax.py =================================================================== --- Lib/test/test_syntax.py (revision 62293) +++ Lib/test/test_syntax.py (working copy) @@ -476,7 +476,7 @@ import unittest import warnings -from test import test_support +from test import support class SyntaxTestCase(unittest.TestCase): @@ -548,9 +548,9 @@ self._check_error("int(base=10, '2')", "non-keyword arg") def test_main(): - test_support.run_unittest(SyntaxTestCase) + support.run_unittest(SyntaxTestCase) from test import test_syntax - test_support.run_doctest(test_syntax, verbosity=True) + support.run_doctest(test_syntax, verbosity=True) if __name__ == "__main__": test_main() Index: Lib/test/test_compare.py =================================================================== --- Lib/test/test_compare.py (revision 62293) +++ Lib/test/test_compare.py (working copy) @@ -1,5 +1,5 @@ import unittest -from test import test_support +from test import support class Empty: def __repr__(self): @@ -61,7 +61,7 @@ def test_main(): - test_support.run_unittest(ComparisonTest) + support.run_unittest(ComparisonTest) if __name__ == '__main__': test_main() Index: Lib/test/test_wait4.py =================================================================== --- Lib/test/test_wait4.py (revision 62293) +++ Lib/test/test_wait4.py (working copy) @@ -4,7 +4,7 @@ import os import time from test.fork_wait import ForkWait -from test.test_support import TestSkipped, run_unittest, reap_children +from test.support import TestSkipped, run_unittest, reap_children try: os.fork Index: Lib/test/test_compile.py =================================================================== --- Lib/test/test_compile.py (revision 62293) +++ Lib/test/test_compile.py (working copy) @@ -1,7 +1,7 @@ import unittest import sys import _ast -from test import test_support +from test import support class TestSpecifics(unittest.TestCase): @@ -444,7 +444,7 @@ def test_main(): - test_support.run_unittest(TestSpecifics) + support.run_unittest(TestSpecifics) if __name__ == "__main__": test_main() Index: Lib/test/test_fractions.py =================================================================== --- Lib/test/test_fractions.py (revision 62293) +++ Lib/test/test_fractions.py (working copy) @@ -1,7 +1,7 @@ """Tests for Lib/fractions.py.""" from decimal import Decimal -from test.test_support import run_unittest +from test.support import run_unittest import math import operator import fractions Index: Lib/test/test_nis.py =================================================================== --- Lib/test/test_nis.py (revision 62293) +++ Lib/test/test_nis.py (working copy) @@ -1,4 +1,4 @@ -from test import test_support +from test import support import unittest import nis @@ -8,7 +8,7 @@ maps = nis.maps() except nis.error as msg: # NIS is probably not active, so this test isn't useful - if test_support.verbose: + if support.verbose: print("Test Skipped:", msg) # Can't raise TestSkipped as regrtest only recognizes the exception # import time. @@ -37,7 +37,7 @@ break def test_main(): - test_support.run_unittest(NisTests) + support.run_unittest(NisTests) if __name__ == '__main__': test_main() Index: Lib/test/test_parser.py =================================================================== --- Lib/test/test_parser.py (revision 62293) +++ Lib/test/test_parser.py (working copy) @@ -1,7 +1,7 @@ import parser import unittest import sys -from test import test_support +from test import support # # First, we test that we can generate trees from valid source fragments, @@ -471,7 +471,7 @@ self.assertRaises(MemoryError, parser.expr, e) def test_main(): - test_support.run_unittest( + support.run_unittest( RoundtripLegalSyntaxTestCase, IllegalSyntaxTestCase, CompileTestCase, Index: Lib/test/test_exception_variations.py =================================================================== --- Lib/test/test_exception_variations.py (revision 62293) +++ Lib/test/test_exception_variations.py (working copy) @@ -1,5 +1,5 @@ -from test.test_support import run_unittest +from test.support import run_unittest import unittest class ExceptionTestCase(unittest.TestCase): Index: Lib/test/test_openpty.py =================================================================== --- Lib/test/test_openpty.py (revision 62293) +++ Lib/test/test_openpty.py (working copy) @@ -1,7 +1,7 @@ # Test to see if openpty works. (But don't worry if it isn't available.) import os, unittest -from test.test_support import run_unittest, TestSkipped +from test.support import run_unittest, TestSkipped if not hasattr(os, "openpty"): raise TestSkipped("No openpty() available.") Index: Lib/test/list_tests.py =================================================================== --- Lib/test/list_tests.py (revision 62293) +++ Lib/test/list_tests.py (working copy) @@ -5,7 +5,7 @@ import sys import os -from test import test_support, seq_tests +from test import support, seq_tests def CmpToKey(mycmp): 'Convert a cmp= function into a key= function' @@ -66,14 +66,14 @@ d.append(d) d.append(400) try: - fo = open(test_support.TESTFN, "w") + fo = open(support.TESTFN, "w") fo.write(str(d)) fo.close() - fo = open(test_support.TESTFN, "r") + fo = open(support.TESTFN, "r") self.assertEqual(fo.read(), repr(d)) finally: fo.close() - os.remove(test_support.TESTFN) + os.remove(support.TESTFN) def test_set_subscript(self): a = self.type2test(range(20)) Index: Lib/test/test_audioop.py =================================================================== --- Lib/test/test_audioop.py (revision 62293) +++ Lib/test/test_audioop.py (working copy) @@ -1,6 +1,6 @@ # Test audioop. import audioop -from test.test_support import verbose +from test.support import verbose def gendata1(): return b'\0\1\2' Index: Lib/test/test_iterlen.py =================================================================== --- Lib/test/test_iterlen.py (revision 62293) +++ Lib/test/test_iterlen.py (working copy) @@ -42,7 +42,7 @@ """ import unittest -from test import test_support +from test import support from itertools import repeat from collections import deque from builtins import len as _len @@ -211,7 +211,7 @@ TestList, TestListReversed, ] - test_support.run_unittest(*unittests) + support.run_unittest(*unittests) if __name__ == "__main__": test_main() Index: Lib/test/test_doctest.py =================================================================== --- Lib/test/test_doctest.py (revision 62293) +++ Lib/test/test_doctest.py (working copy) @@ -2,7 +2,7 @@ Test script for doctest. """ -from test import test_support +from test import support import doctest import warnings @@ -2417,10 +2417,10 @@ def test_main(): # Check the doctest cases in doctest itself: - test_support.run_doctest(doctest, verbosity=True) + support.run_doctest(doctest, verbosity=True) # Check the doctest cases defined here: from test import test_doctest - test_support.run_doctest(test_doctest, verbosity=True) + support.run_doctest(test_doctest, verbosity=True) import trace, sys, re, io def test_coverage(coverdir): Index: Lib/test/test_rfc822.py =================================================================== --- Lib/test/test_rfc822.py (revision 62293) +++ Lib/test/test_rfc822.py (working copy) @@ -1,6 +1,6 @@ import rfc822 import unittest -from test import test_support +from test import support try: from io import StringIO @@ -249,7 +249,7 @@ def test_main(): - test_support.run_unittest(MessageTestCase) + support.run_unittest(MessageTestCase) if __name__ == "__main__": Index: Lib/test/test_httplib.py =================================================================== --- Lib/test/test_httplib.py (revision 62293) +++ Lib/test/test_httplib.py (working copy) @@ -4,9 +4,9 @@ from unittest import TestCase -from test import test_support +from test import support -HOST = test_support.HOST +HOST = support.HOST class FakeSocket: def __init__(self, text, fileclass=io.BytesIO): @@ -206,7 +206,7 @@ def setUp(self): self.serv = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - TimeoutTest.PORT = test_support.bind_port(self.serv) + TimeoutTest.PORT = support.bind_port(self.serv) self.serv.listen(5) def tearDown(self): @@ -252,7 +252,7 @@ self.assertEqual(h.timeout, 30) def test_main(verbose=None): - test_support.run_unittest(HeaderTests, OfflineTest, BasicTest, TimeoutTest, + support.run_unittest(HeaderTests, OfflineTest, BasicTest, TimeoutTest, HTTPSTimeoutTest) if __name__ == '__main__': Index: Lib/test/test_thread.py =================================================================== --- Lib/test/test_thread.py (revision 62293) +++ Lib/test/test_thread.py (working copy) @@ -1,7 +1,7 @@ import os import unittest import random -from test import test_support +from test import support import thread import time @@ -13,7 +13,7 @@ def verbose_print(arg): """Helper function for printing out debugging output.""" - if test_support.verbose: + if support.verbose: with _print_mutex: print(arg) @@ -159,7 +159,7 @@ self.done_mutex.release() def test_main(): - test_support.run_unittest(ThreadRunningTests, BarrierTest) + support.run_unittest(ThreadRunningTests, BarrierTest) if __name__ == "__main__": test_main() Index: Lib/test/test_hashlib.py =================================================================== --- Lib/test/test_hashlib.py (revision 62293) +++ Lib/test/test_hashlib.py (working copy) @@ -8,7 +8,7 @@ import hashlib import unittest -from test import test_support +from test import support def hexstr(s): @@ -186,7 +186,7 @@ def test_main(): - test_support.run_unittest(HashLibTestCase) + support.run_unittest(HashLibTestCase) if __name__ == "__main__": Index: Lib/test/test_capi.py =================================================================== --- Lib/test/test_capi.py (revision 62293) +++ Lib/test/test_capi.py (working copy) @@ -2,7 +2,7 @@ # these are all functions _testcapi exports whose name begins with 'test_'. import sys -from test import test_support +from test import support import _testcapi def test_main(): @@ -10,13 +10,13 @@ for name in dir(_testcapi): if name.startswith('test_'): test = getattr(_testcapi, name) - if test_support.verbose: + if support.verbose: print("internal", name) test() # some extra thread-state tests driven via _testcapi def TestThreadState(): - if test_support.verbose: + if support.verbose: print("auto-thread-state") idents = [] @@ -29,7 +29,7 @@ time.sleep(1) # Check our main thread is in the list exactly 3 times. if idents.count(thread.get_ident()) != 3: - raise test_support.TestFailed( + raise support.TestFailed( "Couldn't find main thread correctly in the list") try: Index: Lib/test/test_mimetypes.py =================================================================== --- Lib/test/test_mimetypes.py (revision 62293) +++ Lib/test/test_mimetypes.py (working copy) @@ -2,7 +2,7 @@ import io import unittest -from test import test_support +from test import support # Tell it we don't know about external files: mimetypes.knownfiles = [] @@ -63,7 +63,7 @@ def test_main(): - test_support.run_unittest(MimeTypesTestCase) + support.run_unittest(MimeTypesTestCase) if __name__ == "__main__": Index: Lib/test/outstanding_bugs.py =================================================================== --- Lib/test/outstanding_bugs.py (revision 62293) +++ Lib/test/outstanding_bugs.py (working copy) @@ -7,7 +7,7 @@ # import unittest -from test import test_support +from test import support # # One test case for outstanding bugs at the moment: @@ -22,7 +22,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 test_issue1395_1(self): @@ -81,7 +81,7 @@ def test_main(): - test_support.run_unittest( + support.run_unittest( TextIOWrapperTest) if __name__ == "__main__": Index: Lib/test/test_keywordonlyarg.py =================================================================== --- Lib/test/test_keywordonlyarg.py (revision 62293) +++ Lib/test/test_keywordonlyarg.py (working copy) @@ -6,7 +6,7 @@ __email__ = "seojiwon at gmail dot com" import unittest -from test.test_support import run_unittest +from test.support import run_unittest def posonly_sum(pos_arg1, *arg, **kwarg): return pos_arg1 + sum(arg) + sum(kwarg.values()) Index: Lib/test/test_pep247.py =================================================================== --- Lib/test/test_pep247.py (revision 62293) +++ Lib/test/test_pep247.py (working copy) @@ -6,7 +6,7 @@ import hmac import unittest from hashlib import md5, sha1, sha224, sha256, sha384, sha512 -from test import test_support +from test import support class Pep247Test(unittest.TestCase): @@ -62,7 +62,7 @@ self.check_module(hmac, key=b'abc') def test_main(): - test_support.run_unittest(Pep247Test) + support.run_unittest(Pep247Test) if __name__ == '__main__': test_main() Index: Lib/test/test_tcl.py =================================================================== --- Lib/test/test_tcl.py (revision 62293) +++ Lib/test/test_tcl.py (working copy) @@ -2,7 +2,7 @@ import unittest import os -from test import test_support +from test import support from Tkinter import Tcl from _tkinter import TclError @@ -151,7 +151,7 @@ os.environ['DISPLAY'] = old_display def test_main(): - test_support.run_unittest(TclTest) + support.run_unittest(TclTest) if __name__ == "__main__": test_main() Index: Lib/test/test_xml_etree.py =================================================================== --- Lib/test/test_xml_etree.py (revision 62293) +++ Lib/test/test_xml_etree.py (working copy) @@ -5,7 +5,7 @@ import doctest import sys -from test import test_support +from test import support SAMPLE_XML = """ @@ -345,7 +345,7 @@ def test_main(): from test import test_xml_etree - test_support.run_doctest(test_xml_etree, verbosity=True) + support.run_doctest(test_xml_etree, verbosity=True) if __name__ == '__main__': test_main() Index: Lib/test/test_sort.py =================================================================== --- Lib/test/test_sort.py (revision 62293) +++ Lib/test/test_sort.py (working copy) @@ -1,9 +1,9 @@ -from test import test_support +from test import support import random import sys import unittest -verbose = test_support.verbose +verbose = support.verbose nerrors = 0 def CmpToKey(mycmp): @@ -261,14 +261,14 @@ TestBugs, ) - test_support.run_unittest(*test_classes) + support.run_unittest(*test_classes) # verify reference counting if verbose and hasattr(sys, "gettotalrefcount"): import gc counts = [None] * 5 for i in range(len(counts)): - test_support.run_unittest(*test_classes) + support.run_unittest(*test_classes) gc.collect() counts[i] = sys.gettotalrefcount() print(counts) Index: Lib/test/test_defaultdict.py =================================================================== --- Lib/test/test_defaultdict.py (revision 62293) +++ Lib/test/test_defaultdict.py (working copy) @@ -4,7 +4,7 @@ import copy import tempfile import unittest -from test import test_support +from test import support from collections import defaultdict @@ -166,7 +166,7 @@ def test_main(): - test_support.run_unittest(TestDefaultDict) + support.run_unittest(TestDefaultDict) if __name__ == "__main__": test_main() Index: Lib/test/test_codecencodings_hk.py =================================================================== --- Lib/test/test_codecencodings_hk.py (revision 62293) +++ Lib/test/test_codecencodings_hk.py (working copy) @@ -4,7 +4,7 @@ # Codec encoding tests for HongKong encodings. # -from test import test_support +from test import support from test import test_multibytecodec_support import unittest @@ -21,7 +21,7 @@ ) def test_main(): - test_support.run_unittest(__name__) + support.run_unittest(__name__) if __name__ == "__main__": test_main() Index: Lib/test/test_operator.py =================================================================== --- Lib/test/test_operator.py (revision 62293) +++ Lib/test/test_operator.py (working copy) @@ -1,7 +1,7 @@ import operator import unittest -from test import test_support +from test import support class Seq1: def __init__(self, lst): @@ -465,14 +465,14 @@ OperatorTestCase, ) - test_support.run_unittest(*test_classes) + support.run_unittest(*test_classes) # verify reference counting if verbose and hasattr(sys, "gettotalrefcount"): import gc counts = [None] * 5 for i in range(len(counts)): - test_support.run_unittest(*test_classes) + support.run_unittest(*test_classes) gc.collect() counts[i] = sys.gettotalrefcount() print(counts) Index: Lib/test/test_cmath.py =================================================================== --- Lib/test/test_cmath.py (revision 62293) +++ Lib/test/test_cmath.py (working copy) @@ -1,4 +1,4 @@ -from test.test_support import run_unittest +from test.support import run_unittest import unittest import cmath, math Index: Lib/test/test_unary.py =================================================================== --- Lib/test/test_unary.py (revision 62293) +++ Lib/test/test_unary.py (working copy) @@ -1,7 +1,7 @@ """Test compiler changes for unary ops (+, -, ~) introduced in Python 2.2""" import unittest -from test.test_support import run_unittest +from test.support import run_unittest class UnaryOpTestCase(unittest.TestCase): Index: Lib/test/test_abstract_numbers.py =================================================================== --- Lib/test/test_abstract_numbers.py (revision 62293) +++ Lib/test/test_abstract_numbers.py (working copy) @@ -5,7 +5,7 @@ import unittest from numbers import Complex, Real, Rational, Integral from numbers import Number -from test import test_support +from test import support class TestNumbers(unittest.TestCase): def test_int(self): @@ -40,7 +40,7 @@ self.assertRaises(TypeError, int, c1) def test_main(): - test_support.run_unittest(TestNumbers) + support.run_unittest(TestNumbers) if __name__ == "__main__": Index: Lib/test/pickletester.py =================================================================== --- Lib/test/pickletester.py (revision 62293) +++ Lib/test/pickletester.py (working copy) @@ -3,7 +3,7 @@ import pickletools import copy_reg -from test.test_support import TestFailed, TESTFN, run_with_locale +from test.support import TestFailed, TESTFN, run_with_locale from pickle import bytes_types Index: Lib/test/test_zlib.py =================================================================== --- Lib/test/test_zlib.py (revision 62293) +++ Lib/test/test_zlib.py (working copy) @@ -1,5 +1,5 @@ import unittest -from test import test_support +from test import support import zlib import binascii import random @@ -460,7 +460,7 @@ def test_main(): - test_support.run_unittest( + support.run_unittest( ChecksumTestCase, ExceptionTestCase, CompressTestCase, Index: Lib/test/test_types.py =================================================================== --- Lib/test/test_types.py (revision 62293) +++ Lib/test/test_types.py (working copy) @@ -1,6 +1,6 @@ # Python test set -- part 6, built-in types -from test.test_support import run_unittest +from test.support import run_unittest import unittest import sys Index: Lib/test/test_re.py =================================================================== --- Lib/test/test_re.py (revision 62293) +++ Lib/test/test_re.py (working copy) @@ -1,7 +1,7 @@ import sys sys.path = ['.'] + sys.path -from test.test_support import verbose, run_unittest, catch_warning +from test.support import verbose, run_unittest, catch_warning import re from re import Scanner import sys, os, traceback Index: Lib/test/test_bigaddrspace.py =================================================================== --- Lib/test/test_bigaddrspace.py (revision 62293) +++ Lib/test/test_bigaddrspace.py (working copy) @@ -1,5 +1,5 @@ -from test import test_support -from test.test_support import bigaddrspacetest, MAX_Py_ssize_t +from test import support +from test.support import bigaddrspacetest, MAX_Py_ssize_t import unittest import operator @@ -38,9 +38,9 @@ def test_main(): - test_support.run_unittest(StrTest) + support.run_unittest(StrTest) if __name__ == '__main__': if len(sys.argv) > 1: - test_support.set_memlimit(sys.argv[1]) + support.set_memlimit(sys.argv[1]) test_main() Index: Lib/test/test_codeop.py =================================================================== --- Lib/test/test_codeop.py (revision 62293) +++ Lib/test/test_codeop.py (working copy) @@ -3,7 +3,7 @@ Nick Mathewson """ import unittest -from test.test_support import run_unittest, is_jython +from test.support import run_unittest, is_jython from codeop import compile_command, PyCF_DONT_IMPLY_DEDENT import io Index: Lib/test/test_asynchat.py =================================================================== --- Lib/test/test_asynchat.py (revision 62293) +++ Lib/test/test_asynchat.py (working copy) @@ -4,9 +4,9 @@ import asyncore, asynchat, socket, threading, time import unittest import sys -from test import test_support +from test import support -HOST = test_support.HOST +HOST = support.HOST SERVER_QUIT = b'QUIT\n' class echo_server(threading.Thread): @@ -18,7 +18,7 @@ threading.Thread.__init__(self) self.event = event self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - self.port = test_support.bind_port(self.sock) + self.port = support.bind_port(self.sock) def run(self): self.sock.listen(1) @@ -248,7 +248,7 @@ def test_main(verbose=None): - test_support.run_unittest(TestAsynchat, TestAsynchat_WithPoll, + support.run_unittest(TestAsynchat, TestAsynchat_WithPoll, TestHelperFunctions, TestFifo) if __name__ == "__main__": Index: Lib/test/test_pprint.py =================================================================== --- Lib/test/test_pprint.py (revision 62293) +++ Lib/test/test_pprint.py (working copy) @@ -1,5 +1,5 @@ import pprint -import test.test_support +import test.support import unittest import test.test_set @@ -396,7 +396,7 @@ def test_main(): - test.test_support.run_unittest(QueryTestCase) + test.support.run_unittest(QueryTestCase) if __name__ == "__main__": Index: Lib/test/test_codeccallbacks.py =================================================================== --- Lib/test/test_codeccallbacks.py (revision 62293) +++ Lib/test/test_codeccallbacks.py (working copy) @@ -1,4 +1,4 @@ -import test.test_support, unittest +import test.support, unittest import sys, codecs, htmlentitydefs, unicodedata class PosReturn: @@ -843,7 +843,7 @@ self.assertRaises(TypeError, data.decode, encoding, "test.replacing") def test_main(): - test.test_support.run_unittest(CodecCallbackTest) + test.support.run_unittest(CodecCallbackTest) if __name__ == "__main__": test_main() Index: Lib/test/test_getargs2.py =================================================================== --- Lib/test/test_getargs2.py (revision 62293) +++ Lib/test/test_getargs2.py (working copy) @@ -1,5 +1,5 @@ import unittest -from test import test_support +from test import support from _testcapi import getargs_keywords import warnings @@ -306,7 +306,7 @@ pass # PY_LONG_LONG not available else: tests.append(LongLong_TestCase) - test_support.run_unittest(*tests) + support.run_unittest(*tests) if __name__ == "__main__": test_main() Index: Lib/test/test_socketserver.py =================================================================== --- Lib/test/test_socketserver.py (revision 62293) +++ Lib/test/test_socketserver.py (working copy) @@ -15,14 +15,14 @@ import unittest import SocketServer -import test.test_support -from test.test_support import reap_children, verbose, TestSkipped -from test.test_support import TESTFN as TEST_FILE +import test.support +from test.support import reap_children, verbose, TestSkipped +from test.support import TESTFN as TEST_FILE -test.test_support.requires("network") +test.support.requires("network") TEST_STR = b"hello world\n" -HOST = test.test_support.HOST +HOST = test.support.HOST HAVE_UNIX_SOCKETS = hasattr(socket, "AF_UNIX") HAVE_FORKING = hasattr(os, "fork") and os.name != "os2" @@ -249,7 +249,7 @@ # If the import lock is held, the threads will hang raise TestSkipped("can't run when import lock is held") - test.test_support.run_unittest(SocketServerTest) + test.support.run_unittest(SocketServerTest) if __name__ == "__main__": test_main() Index: Lib/test/test_SimpleHTTPServer.py =================================================================== --- Lib/test/test_SimpleHTTPServer.py (revision 62293) +++ Lib/test/test_SimpleHTTPServer.py (working copy) @@ -5,7 +5,7 @@ import os, unittest from SimpleHTTPServer import SimpleHTTPRequestHandler -from test import test_support +from test import support class SocketlessRequestHandler (SimpleHTTPRequestHandler): @@ -35,7 +35,7 @@ def test_main(): - test_support.run_unittest(SimpleHTTPRequestHandlerTestCase) + support.run_unittest(SimpleHTTPRequestHandlerTestCase) if __name__ == "__main__": test_main() Index: Lib/test/test_peepholer.py =================================================================== --- Lib/test/test_peepholer.py (revision 62293) +++ Lib/test/test_peepholer.py (working copy) @@ -220,16 +220,16 @@ def test_main(verbose=None): import sys - from test import test_support + from test import support test_classes = (TestTranforms,) - test_support.run_unittest(*test_classes) + support.run_unittest(*test_classes) # verify reference counting if verbose and hasattr(sys, "gettotalrefcount"): import gc counts = [None] * 5 for i in range(len(counts)): - test_support.run_unittest(*test_classes) + support.run_unittest(*test_classes) gc.collect() counts[i] = sys.gettotalrefcount() print(counts) Index: Lib/test/xmltests.py =================================================================== --- Lib/test/xmltests.py (revision 62293) +++ Lib/test/xmltests.py (working copy) @@ -2,9 +2,9 @@ # standard library. import sys -import test.test_support +import test.support -test.test_support.verbose = 0 +test.support.verbose = 0 def runtest(name): __import__(name) Index: Lib/test/test_xdrlib.py =================================================================== --- Lib/test/test_xdrlib.py (revision 62293) +++ Lib/test/test_xdrlib.py (working copy) @@ -1,4 +1,4 @@ -from test import test_support +from test import support import unittest import xdrlib @@ -50,7 +50,7 @@ self.assertRaises(EOFError, up.unpack_uint) def test_main(): - test_support.run_unittest(XDRTest) + support.run_unittest(XDRTest) if __name__ == "__main__": test_main() Index: Lib/test/test_ossaudiodev.py =================================================================== --- Lib/test/test_ossaudiodev.py (revision 62293) +++ Lib/test/test_ossaudiodev.py (working copy) @@ -1,7 +1,7 @@ -from test import test_support -test_support.requires('audio') +from test import support +support.requires('audio') -from test.test_support import findfile, TestSkipped +from test.support import findfile, TestSkipped import errno import ossaudiodev @@ -167,7 +167,7 @@ raise TestSkipped(msg) raise dsp.close() - test_support.run_unittest(__name__) + support.run_unittest(__name__) if __name__ == "__main__": test_main() Index: Lib/test/test_abc.py =================================================================== --- Lib/test/test_abc.py (revision 62293) +++ Lib/test/test_abc.py (working copy) @@ -4,7 +4,7 @@ """Unit tests for abc.py.""" import unittest -from test import test_support +from test import support import abc from inspect import isabstract @@ -170,7 +170,7 @@ def test_main(): - test_support.run_unittest(TestABC) + support.run_unittest(TestABC) if __name__ == "__main__": Index: Lib/test/test_sgmllib.py =================================================================== --- Lib/test/test_sgmllib.py (revision 62293) +++ Lib/test/test_sgmllib.py (working copy) @@ -2,7 +2,7 @@ import re import sgmllib import unittest -from test import test_support +from test import support class EventCollector(sgmllib.SGMLParser): @@ -365,7 +365,7 @@ # Just verify this code doesn't cause a hang. CHUNK = 1024 # increasing this to 8212 makes the problem go away - f = open(test_support.findfile('sgml_input.html'), encoding="latin-1") + f = open(support.findfile('sgml_input.html'), encoding="latin-1") fp = sgmllib.SGMLParser() while 1: data = f.read(CHUNK) @@ -431,7 +431,7 @@ def test_main(): - test_support.run_unittest(SGMLParserTestCase) + support.run_unittest(SGMLParserTestCase) if __name__ == "__main__": Index: Lib/test/test_long_future.py =================================================================== --- Lib/test/test_long_future.py (revision 62293) +++ Lib/test/test_long_future.py (working copy) @@ -4,7 +4,7 @@ # trick just part of test_long into using future division. import unittest -from test.test_support import run_unittest +from test.support import run_unittest class TrueDivisionTests(unittest.TestCase): def test(self): Index: Lib/test/test_pyexpat.py =================================================================== --- Lib/test/test_pyexpat.py (revision 62293) +++ Lib/test/test_pyexpat.py (working copy) @@ -8,7 +8,7 @@ import pyexpat from xml.parsers import expat -from test.test_support import sortdict, run_unittest +from test.support import sortdict, run_unittest class SetAttributeTest(unittest.TestCase): Index: Lib/test/test_mmap.py =================================================================== --- Lib/test/test_mmap.py (revision 62293) +++ Lib/test/test_mmap.py (working copy) @@ -1,4 +1,4 @@ -from test.test_support import TESTFN, run_unittest +from test.support import TESTFN, run_unittest import mmap import unittest import os, re Index: Lib/test/test_winreg.py =================================================================== --- Lib/test/test_winreg.py (revision 62293) +++ Lib/test/test_winreg.py (working copy) @@ -6,7 +6,7 @@ import os, sys import unittest -from test import test_support +from test import support test_key_name = "SOFTWARE\\Python Registry Test Key - Delete Me" @@ -161,7 +161,7 @@ self.assertEqual(r, os.environ["windir"] + "\\test") def test_main(): - test_support.run_unittest(WinregTests) + support.run_unittest(WinregTests) if __name__ == "__main__": try: Index: Lib/test/test_mhlib.py =================================================================== --- Lib/test/test_mhlib.py (revision 62293) +++ Lib/test/test_mhlib.py (working copy) @@ -7,7 +7,7 @@ ### mhlib. It should. import unittest -from test.test_support import run_unittest, TESTFN, TestSkipped +from test.support import run_unittest, TESTFN, TestSkipped import os import io import sys Index: Lib/test/test_minidom.py =================================================================== --- Lib/test/test_minidom.py (revision 62293) +++ Lib/test/test_minidom.py (working copy) @@ -4,7 +4,7 @@ import sys import pickle from io import StringIO -from test.test_support import verbose, run_unittest, TestSkipped +from test.support import verbose, run_unittest, TestSkipped import unittest import xml.dom Index: Lib/test/test_structseq.py =================================================================== --- Lib/test/test_structseq.py (revision 62293) +++ Lib/test/test_structseq.py (working copy) @@ -1,5 +1,5 @@ import unittest -from test import test_support +from test import support import time @@ -114,7 +114,7 @@ L[start:stop:step]) def test_main(): - test_support.run_unittest(StructSeqTest) + support.run_unittest(StructSeqTest) if __name__ == "__main__": test_main() Index: Lib/test/test_stringprep.py =================================================================== --- Lib/test/test_stringprep.py (revision 62293) +++ Lib/test/test_stringprep.py (working copy) @@ -2,7 +2,7 @@ # Since we don't have them, this test checks only a few codepoints. import unittest -from test import test_support +from test import support from stringprep import * @@ -90,7 +90,7 @@ # print p, h.hexdigest() def test_main(): - test_support.run_unittest(StringprepTests) + support.run_unittest(StringprepTests) if __name__ == '__main__': test_main() Index: Lib/test/test_locale.py =================================================================== --- Lib/test/test_locale.py (revision 62293) +++ Lib/test/test_locale.py (working copy) @@ -1,4 +1,4 @@ -from test.test_support import verbose, TestSkipped +from test.support import verbose, TestSkipped import locale import sys Index: Lib/test/test_cgi.py =================================================================== --- Lib/test/test_cgi.py (revision 62293) +++ Lib/test/test_cgi.py (working copy) @@ -1,4 +1,4 @@ -from test.test_support import run_unittest +from test.support import run_unittest import cgi import os import sys Index: Lib/test/test_codecencodings_kr.py =================================================================== --- Lib/test/test_codecencodings_kr.py (revision 62293) +++ Lib/test/test_codecencodings_kr.py (working copy) @@ -4,7 +4,7 @@ # Codec encoding tests for ROK encodings. # -from test import test_support +from test import support from test import test_multibytecodec_support import unittest @@ -63,7 +63,7 @@ ) def test_main(): - test_support.run_unittest(__name__) + support.run_unittest(__name__) if __name__ == "__main__": test_main() Index: Lib/test/test_profilehooks.py =================================================================== --- Lib/test/test_profilehooks.py (revision 62293) +++ Lib/test/test_profilehooks.py (working copy) @@ -2,7 +2,7 @@ import sys import unittest -from test import test_support +from test import support class TestGetProfile(unittest.TestCase): def setUp(self): @@ -357,7 +357,7 @@ except TypeError: pass else: - raise test_support.TestFailed( + raise support.TestFailed( 'sys.setprofile() did not raise TypeError') if p is None: @@ -374,7 +374,7 @@ def test_main(): - test_support.run_unittest( + support.run_unittest( TestGetProfile, ProfileHookTestCase, ProfileSimulatorTestCase Index: Lib/test/test_codecmaps_tw.py =================================================================== --- Lib/test/test_codecmaps_tw.py (revision 62293) +++ Lib/test/test_codecmaps_tw.py (working copy) @@ -4,7 +4,7 @@ # Codec mapping tests for ROC encodings # -from test import test_support +from test import support from test import test_multibytecodec_support import unittest @@ -25,7 +25,7 @@ ] def test_main(): - test_support.run_unittest(__name__) + support.run_unittest(__name__) if __name__ == "__main__": test_main() Index: Lib/test/test_scope.py =================================================================== --- Lib/test/test_scope.py (revision 62293) +++ Lib/test/test_scope.py (working copy) @@ -1,5 +1,5 @@ import unittest -from test.test_support import check_syntax_error, run_unittest +from test.support import check_syntax_error, run_unittest import warnings warnings.filterwarnings("ignore", r"import \*", SyntaxWarning, "") Index: Lib/test/test_cfgparser.py =================================================================== --- Lib/test/test_cfgparser.py (revision 62293) +++ Lib/test/test_cfgparser.py (working copy) @@ -3,7 +3,7 @@ import unittest import collections -from test import test_support +from test import support class SortedDict(collections.UserDict): def items(self): @@ -251,7 +251,7 @@ cf.set("sect", "option2", "splat") def test_read_returns_file_list(self): - file1 = test_support.findfile("cfgparser.1") + file1 = support.findfile("cfgparser.1") # check when we pass a mix of readable and non-readable files: cf = self.newconfig() parsed_files = cf.read([file1, "nonexistant-file"]) @@ -469,7 +469,7 @@ "o4 = 1\n\n") def test_main(): - test_support.run_unittest( + support.run_unittest( ConfigParserTestCase, RawConfigParserTestCase, SafeConfigParserTestCase, Index: Lib/test/test_signal.py =================================================================== --- Lib/test/test_signal.py (revision 62293) +++ Lib/test/test_signal.py (working copy) @@ -1,5 +1,5 @@ import unittest -from test import test_support +from test import support from contextlib import closing, nested import gc import pickle @@ -10,7 +10,7 @@ import sys, os, time, errno if sys.platform[:3] in ('win', 'os2') or sys.platform == 'riscos': - raise test_support.TestSkipped("Can't test signal on %s" % \ + raise support.TestSkipped("Can't test signal on %s" % \ sys.platform) @@ -53,13 +53,13 @@ def handlerA(self, signum, frame): self.a_called = True - if test_support.verbose: + if support.verbose: print("handlerA invoked from signal %s at:\n%s" % ( signum, self.format_frame(frame, limit=1))) def handlerB(self, signum, frame): self.b_called = True - if test_support.verbose: + if support.verbose: print ("handlerB invoked from signal %s at:\n%s" % ( signum, self.format_frame(frame, limit=1))) raise HandlerBCalled(signum, self.format_frame(frame)) @@ -88,7 +88,7 @@ # Let the sub-processes know who to send signals to. pid = os.getpid() - if test_support.verbose: + if support.verbose: print("test runner's pid is", pid) child = ignoring_eintr(subprocess.Popen, ['kill', '-HUP', str(pid)]) @@ -113,7 +113,7 @@ except HandlerBCalled: self.assertTrue(self.b_called) self.assertFalse(self.a_called) - if test_support.verbose: + if support.verbose: print("HandlerBCalled exception caught") child = ignoring_eintr(subprocess.Popen, ['kill', '-USR2', str(pid)]) @@ -130,7 +130,7 @@ # may return early. time.sleep(1) except KeyboardInterrupt: - if test_support.verbose: + if support.verbose: print("KeyboardInterrupt (the alarm() went off)") except: self.fail("Some other exception woke us from pause: %s" % @@ -309,7 +309,7 @@ def sig_alrm(self, *args): self.hndl_called = True - if test_support.verbose: + if support.verbose: print("SIGALRM handler invoked", args) def sig_vtalrm(self, *args): @@ -322,19 +322,19 @@ elif self.hndl_count == 3: # disable ITIMER_VIRTUAL, this function shouldn't be called anymore signal.setitimer(signal.ITIMER_VIRTUAL, 0) - if test_support.verbose: + if support.verbose: print("last SIGVTALRM handler call") self.hndl_count += 1 - if test_support.verbose: + if support.verbose: print("SIGVTALRM handler invoked", args) def sig_prof(self, *args): self.hndl_called = True signal.setitimer(signal.ITIMER_PROF, 0) - if test_support.verbose: + if support.verbose: print("SIGPROF handler invoked", args) def test_itimer_exc(self): @@ -349,7 +349,7 @@ def test_itimer_real(self): self.itimer = signal.ITIMER_REAL signal.setitimer(self.itimer, 1.0) - if test_support.verbose: + if support.verbose: print("\ncall pause()...") signal.pause() @@ -384,7 +384,7 @@ self.assertEqual(self.hndl_called, True) def test_main(): - test_support.run_unittest(BasicSignalTests, InterProcessSignalTests, + support.run_unittest(BasicSignalTests, InterProcessSignalTests, WakeupSignalTests, SiginterruptTest, ItimerTest) Index: Lib/test/test_textwrap.py =================================================================== --- Lib/test/test_textwrap.py (revision 62293) +++ Lib/test/test_textwrap.py (working copy) @@ -9,7 +9,7 @@ # import unittest -from test import test_support +from test import support from textwrap import TextWrapper, wrap, fill, dedent @@ -567,7 +567,7 @@ def test_main(): - test_support.run_unittest(WrapTestCase, + support.run_unittest(WrapTestCase, LongWordTestCase, IndentTestCases, DedentTestCase) Index: Lib/test/test_codecmaps_cn.py =================================================================== --- Lib/test/test_codecmaps_cn.py (revision 62293) +++ Lib/test/test_codecmaps_cn.py (working copy) @@ -4,7 +4,7 @@ # Codec mapping tests for PRC encodings # -from test import test_support +from test import support from test import test_multibytecodec_support import unittest @@ -27,7 +27,7 @@ def test_main(): - test_support.run_unittest(__name__) + support.run_unittest(__name__) if __name__ == "__main__": test_main() Index: Lib/test/test_unicodedata.py =================================================================== --- Lib/test/test_unicodedata.py (revision 62293) +++ Lib/test/test_unicodedata.py (working copy) @@ -5,7 +5,7 @@ (c) Copyright CNRI, All Rights Reserved. NO WARRANTY. """#" -import unittest, test.test_support +import unittest, test.support import hashlib encoding = 'utf-8' @@ -219,7 +219,7 @@ self.assertEquals(self.db.lookup("GOTHIC LETTER FAIHU"), '\U00010346') def test_main(): - test.test_support.run_unittest( + test.support.run_unittest( UnicodeMiscTest, UnicodeMethodsTest, UnicodeFunctionsTest Index: Lib/test/test_queue.py =================================================================== --- Lib/test/test_queue.py (revision 62293) +++ Lib/test/test_queue.py (working copy) @@ -5,7 +5,7 @@ import threading import time import unittest -from test import test_support +from test import support QUEUE_SIZE = 5 @@ -318,7 +318,7 @@ def test_main(): - test_support.run_unittest(QueueTest, LifoQueueTest, PriorityQueueTest, + support.run_unittest(QueueTest, LifoQueueTest, PriorityQueueTest, FailingQueueTest) Index: Lib/test/test_poplib.py =================================================================== --- Lib/test/test_poplib.py (revision 62293) +++ Lib/test/test_poplib.py (working copy) @@ -4,9 +4,9 @@ import time from unittest import TestCase -from test import test_support +from test import support -HOST = test_support.HOST +HOST = support.HOST def server(evt, serv): serv.listen(5) @@ -27,7 +27,7 @@ self.evt = threading.Event() self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.sock.settimeout(3) - self.port = test_support.bind_port(self.sock) + self.port = support.bind_port(self.sock) threading.Thread(target=server, args=(self.evt,self.sock)).start() time.sleep(.1) @@ -65,7 +65,7 @@ def test_main(verbose=None): - test_support.run_unittest(GeneralTests) + support.run_unittest(GeneralTests) if __name__ == '__main__': test_main() Index: Lib/test/test_marshal.py =================================================================== --- Lib/test/test_marshal.py (revision 62293) +++ Lib/test/test_marshal.py (working copy) @@ -1,6 +1,6 @@ #!/usr/bin/env python -from test import test_support +from test import support import marshal import sys import unittest @@ -11,19 +11,19 @@ new = marshal.loads(marshal.dumps(sample, *extra)) self.assertEqual(sample, new) try: - f = open(test_support.TESTFN, "wb") + f = open(support.TESTFN, "wb") try: marshal.dump(sample, f, *extra) finally: f.close() - f = open(test_support.TESTFN, "rb") + f = open(support.TESTFN, "rb") try: new = marshal.load(f) finally: f.close() self.assertEqual(sample, new) finally: - test_support.unlink(test_support.TESTFN) + support.unlink(support.TESTFN) class IntTestCase(unittest.TestCase, HelperMixin): def test_ints(self): @@ -200,7 +200,7 @@ self.assertRaises(ValueError, marshal.dumps, subtyp()) def test_main(): - test_support.run_unittest(IntTestCase, + support.run_unittest(IntTestCase, FloatTestCase, StringTestCase, CodeTestCase, Index: Lib/test/test_bz2.py =================================================================== --- Lib/test/test_bz2.py (revision 62293) +++ Lib/test/test_bz2.py (working copy) @@ -1,6 +1,6 @@ #!/usr/bin/python -from test import test_support -from test.test_support import TESTFN +from test import support +from test.support import TESTFN import unittest from io import BytesIO @@ -333,13 +333,13 @@ self.assertRaises(ValueError, bz2.decompress, self.DATA[:-10]) def test_main(): - test_support.run_unittest( + support.run_unittest( BZ2FileTest, BZ2CompressorTest, BZ2DecompressorTest, FuncTest ) - test_support.reap_children() + support.reap_children() if __name__ == '__main__': test_main() Index: Lib/test/test_urllibnet.py =================================================================== --- Lib/test/test_urllibnet.py (revision 62293) +++ Lib/test/test_urllibnet.py (working copy) @@ -1,7 +1,7 @@ #!/usr/bin/env python import unittest -from test import test_support +from test import support import socket import urllib @@ -166,8 +166,8 @@ def test_specified_path(self): # Make sure that specifying the location of the file to write to works. file_location,info = self.urlretrieve("http://www.python.org/", - test_support.TESTFN) - self.assertEqual(file_location, test_support.TESTFN) + support.TESTFN) + self.assertEqual(file_location, support.TESTFN) self.assert_(os.path.exists(file_location)) FILE = open(file_location, errors='ignore') try: @@ -186,8 +186,8 @@ def test_main(): - test_support.requires('network') - test_support.run_unittest(URLTimeoutTest, + support.requires('network') + support.run_unittest(URLTimeoutTest, urlopenNetworkTests, urlretrieveNetworkTests) Index: Lib/test/test_cookielib.py =================================================================== --- Lib/test/test_cookielib.py (revision 62293) +++ Lib/test/test_cookielib.py (working copy) @@ -3,7 +3,7 @@ import re, os, time from unittest import TestCase -from test import test_support +from test import support class DateTimeTests(TestCase): @@ -234,7 +234,7 @@ def test_lwp_valueless_cookie(self): # cookies with no value should be saved and loaded consistently from cookielib import LWPCookieJar - filename = test_support.TESTFN + filename = support.TESTFN c = LWPCookieJar() interact_netscape(c, "http://www.acme.com/", 'boo') self.assertEqual(c._cookies["www.acme.com"]["/"]["boo"].value, None) @@ -250,7 +250,7 @@ def test_bad_magic(self): from cookielib import LWPCookieJar, MozillaCookieJar, LoadError # IOErrors (eg. file doesn't exist) are allowed to propagate - filename = test_support.TESTFN + filename = support.TESTFN for cookiejar_class in LWPCookieJar, MozillaCookieJar: c = cookiejar_class() try: @@ -356,7 +356,7 @@ # missing = sign in Cookie: header is regarded by Mozilla as a missing # name, and by cookielib as a missing value - filename = test_support.TESTFN + filename = support.TESTFN c = MozillaCookieJar(filename) interact_netscape(c, "http://www.acme.com/", 'eggs') interact_netscape(c, "http://www.acme.com/", '"spam"; path=/foo/') @@ -1505,7 +1505,7 @@ self.assertEquals(len(c), 6) # save and restore - filename = test_support.TESTFN + filename = support.TESTFN try: c.save(filename, ignore_discard=True) @@ -1547,7 +1547,7 @@ year_plus_one = time.localtime()[0] + 1 - filename = test_support.TESTFN + filename = support.TESTFN c = MozillaCookieJar(filename, policy=DefaultCookiePolicy(rfc2965=True)) @@ -1722,7 +1722,7 @@ def test_main(verbose=None): - test_support.run_unittest( + support.run_unittest( DateTimeTests, HeaderTests, CookieTests, Index: Lib/test/test_bsddb3.py =================================================================== --- Lib/test/test_bsddb3.py (revision 62293) +++ Lib/test/test_bsddb3.py (working copy) @@ -7,7 +7,7 @@ import tempfile import time import unittest -from test.test_support import requires, verbose, run_unittest, unlink, rmtree +from test.support import requires, verbose, run_unittest, unlink, rmtree # When running as a script instead of within the regrtest framework, skip the # requires test, since it's obvious we want to run them. Index: Lib/test/test_iter.py =================================================================== --- Lib/test/test_iter.py (revision 62293) +++ Lib/test/test_iter.py (working copy) @@ -1,7 +1,7 @@ # Test iterators. import unittest -from test.test_support import run_unittest, TESTFN, unlink +from test.support import run_unittest, TESTFN, unlink # Test result of triple loop (too big to inline) TRIPLETS = [(0, 0, 0), (0, 0, 1), (0, 0, 2), Index: Lib/test/test_memoryview.py =================================================================== --- Lib/test/test_memoryview.py (revision 62293) +++ Lib/test/test_memoryview.py (working copy) @@ -4,7 +4,7 @@ """ import unittest -import test.test_support +import test.support class MemoryviewTest(unittest.TestCase): @@ -18,7 +18,7 @@ self.assertRaises(TypeError, memoryview, ob, argument=True) def test_main(): - test.test_support.run_unittest(MemoryviewTest) + test.support.run_unittest(MemoryviewTest) if __name__ == "__main__": Index: Lib/test/test_deque.py =================================================================== --- Lib/test/test_deque.py (revision 62293) +++ Lib/test/test_deque.py (working copy) @@ -1,6 +1,6 @@ from collections import deque import unittest -from test import test_support, seq_tests +from test import support, seq_tests from weakref import proxy import copy import pickle @@ -64,27 +64,27 @@ self.assertEqual(list(d), [7, 8, 9]) d = deque(range(200), maxlen=10) d.append(d) - fo = open(test_support.TESTFN, "w") + fo = open(support.TESTFN, "w") try: fo.write(str(d)) fo.close() - fo = open(test_support.TESTFN, "r") + fo = open(support.TESTFN, "r") self.assertEqual(fo.read(), repr(d)) finally: fo.close() - test_support.unlink(test_support.TESTFN) + support.unlink(support.TESTFN) d = deque(range(10), maxlen=None) self.assertEqual(repr(d), 'deque([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])') - fo = open(test_support.TESTFN, "w") + fo = open(support.TESTFN, "w") try: fo.write(str(d)) fo.close() - fo = open(test_support.TESTFN, "r") + fo = open(support.TESTFN, "r") self.assertEqual(fo.read(), repr(d)) finally: fo.close() - test_support.unlink(test_support.TESTFN) + support.unlink(support.TESTFN) def test_comparisons(self): d = deque('xabc'); d.popleft() @@ -283,14 +283,14 @@ d = deque(range(200)) d.append(d) try: - fo = open(test_support.TESTFN, "w") + fo = open(support.TESTFN, "w") print(d, file=fo, end='') fo.close() - fo = open(test_support.TESTFN, "r") + fo = open(support.TESTFN, "r") self.assertEqual(fo.read(), repr(d)) finally: fo.close() - test_support.unlink(test_support.TESTFN) + support.unlink(support.TESTFN) def test_init(self): self.assertRaises(TypeError, deque, 'abc', 2, 3); @@ -668,21 +668,21 @@ TestSubclassWithKwargs, ) - test_support.run_unittest(*test_classes) + support.run_unittest(*test_classes) # verify reference counting if verbose and hasattr(sys, "gettotalrefcount"): import gc counts = [None] * 5 for i in range(len(counts)): - test_support.run_unittest(*test_classes) + support.run_unittest(*test_classes) gc.collect() counts[i] = sys.gettotalrefcount() print(counts) # doctests from test import test_deque - test_support.run_doctest(test_deque, verbose) + support.run_doctest(test_deque, verbose) if __name__ == "__main__": test_main(verbose=True) Index: Lib/test/test_strptime.py =================================================================== --- Lib/test/test_strptime.py (revision 62293) +++ Lib/test/test_strptime.py (working copy) @@ -5,7 +5,7 @@ import locale import re import sys -from test import test_support +from test import support from datetime import date as datetime_date import _strptime @@ -551,7 +551,7 @@ def test_main(): - test_support.run_unittest( + support.run_unittest( getlang_Tests, LocaleTime_Tests, TimeRETests, Index: Lib/test/test_whichdb.py =================================================================== --- Lib/test/test_whichdb.py (revision 62293) +++ Lib/test/test_whichdb.py (working copy) @@ -4,14 +4,14 @@ """ import os -import test.test_support +import test.support import unittest import whichdb import anydbm import glob from test.test_anydbm import delete_files, dbm_iterator -_fname = test.test_support.TESTFN +_fname = test.support.TESTFN class WhichDBTestCase(unittest.TestCase): # Actual test methods are added to namespace @@ -27,7 +27,7 @@ name = module.__name__ if name == 'dumbdbm': continue # whichdb can't support dumbdbm - test.test_support.unlink(_fname) + test.support.unlink(_fname) f = module.open(_fname, 'c') f.close() self.assertEqual(name, whichdb.whichdb(_fname)) @@ -50,7 +50,7 @@ def test_main(): try: - test.test_support.run_unittest(WhichDBTestCase) + test.support.run_unittest(WhichDBTestCase) finally: delete_files() Index: Lib/test/test_eof.py =================================================================== --- Lib/test/test_eof.py (revision 62293) +++ Lib/test/test_eof.py (working copy) @@ -2,7 +2,7 @@ """test script for a few new invalid token catches""" import unittest -from test import test_support +from test import support class EOFTestCase(unittest.TestCase): def test_EOFC(self): @@ -13,7 +13,7 @@ except SyntaxError as msg: self.assertEqual(str(msg), expect) else: - raise test_support.TestFailed + raise support.TestFailed def test_EOFS(self): expect = "EOF while scanning triple-quoted string (, line 1)" @@ -22,10 +22,10 @@ except SyntaxError as msg: self.assertEqual(str(msg), expect) else: - raise test_support.TestFailed + raise support.TestFailed def test_main(): - test_support.run_unittest(EOFTestCase) + support.run_unittest(EOFTestCase) if __name__ == "__main__": test_main() Index: Lib/test/test_calendar.py =================================================================== --- Lib/test/test_calendar.py (revision 62293) +++ Lib/test/test_calendar.py (working copy) @@ -1,7 +1,7 @@ import calendar import unittest -from test import test_support +from test import support result_2004_text = """ @@ -383,7 +383,7 @@ def test_main(): - test_support.run_unittest( + support.run_unittest( OutputTestCase, CalendarTestCase, MondayTestCase, Index: Lib/test/test_epoll.py =================================================================== --- Lib/test/test_epoll.py (revision 62293) +++ Lib/test/test_epoll.py (working copy) @@ -29,15 +29,15 @@ import tempfile import unittest -from test import test_support +from test import support if not hasattr(select, "epoll"): - raise test_support.TestSkipped("test works only on Linux 2.6") + raise support.TestSkipped("test works only on Linux 2.6") try: select.epoll() except IOError as e: if e.errno == errno.ENOSYS: - raise test_support.TestSkipped("kernel doesn't support epoll()") + raise support.TestSkipped("kernel doesn't support epoll()") class TestEPoll(unittest.TestCase): @@ -189,7 +189,7 @@ ep.unregister(fd) def test_main(): - test_support.run_unittest(TestEPoll) + support.run_unittest(TestEPoll) if __name__ == "__main__": test_main() Index: Lib/test/test_zipfile64.py =================================================================== --- Lib/test/test_zipfile64.py (revision 62293) +++ Lib/test/test_zipfile64.py (working copy) @@ -1,11 +1,11 @@ # Tests of the full ZIP64 functionality of zipfile -# The test_support.requires call is the only reason for keeping this separate +# The support.requires call is the only reason for keeping this separate # from test_zipfile -from test import test_support +from test import support # XXX(nnorwitz): disable this test by looking for extra largfile resource # which doesn't exist. This test takes over 30 minutes to run in general # and requires more disk space than most of the buildbots. -test_support.requires( +support.requires( 'extralargefile', 'test requires loads of disk-space bytes and a long time to run' ) @@ -23,7 +23,7 @@ from io import StringIO from tempfile import TemporaryFile -from test.test_support import TESTFN, run_unittest +from test.support import TESTFN, run_unittest TESTFN2 = TESTFN + "2" Index: Lib/test/test_unpack_ex.py =================================================================== --- Lib/test/test_unpack_ex.py (revision 62293) +++ Lib/test/test_unpack_ex.py (working copy) @@ -166,9 +166,9 @@ def test_main(verbose=False): import sys - from test import test_support + from test import support from test import test_unpack_ex - test_support.run_doctest(test_unpack_ex, verbose) + support.run_doctest(test_unpack_ex, verbose) if __name__ == "__main__": test_main(verbose=True) Index: Lib/test/test_htmlparser.py =================================================================== --- Lib/test/test_htmlparser.py (revision 62293) +++ Lib/test/test_htmlparser.py (working copy) @@ -3,7 +3,7 @@ import HTMLParser import pprint import unittest -from test import test_support +from test import support class EventCollector(HTMLParser.HTMLParser): @@ -315,7 +315,7 @@ def test_main(): - test_support.run_unittest(HTMLParserTestCase) + support.run_unittest(HTMLParserTestCase) if __name__ == "__main__": Index: Lib/test/test_binascii.py =================================================================== --- Lib/test/test_binascii.py (revision 62293) +++ Lib/test/test_binascii.py (working copy) @@ -1,6 +1,6 @@ """Test the binascii C module.""" -from test import test_support +from test import support import unittest import binascii @@ -169,7 +169,7 @@ binascii.crc_hqx('', 0) def test_main(): - test_support.run_unittest(BinASCIITest) + support.run_unittest(BinASCIITest) if __name__ == "__main__": test_main() Index: Lib/test/test_dummy_thread.py =================================================================== --- Lib/test/test_dummy_thread.py (revision 62293) +++ Lib/test/test_dummy_thread.py (working copy) @@ -10,7 +10,7 @@ import Queue import random import unittest -from test import test_support +from test import support DELAY = 0 # Set > 0 when testing a module other than dummy_thread, such as # the 'thread' module. @@ -71,13 +71,13 @@ self.lock.acquire() start_time = int(time.time()) _thread.start_new_thread(delay_unlock,(self.lock, DELAY)) - if test_support.verbose: + if support.verbose: print() print("*** Waiting for thread to release the lock "\ "(approx. %s sec.) ***" % DELAY) self.lock.acquire() end_time = int(time.time()) - if test_support.verbose: + if support.verbose: print("done") self.failUnless((end_time - start_time) >= DELAY, "Blocking by unconditional acquiring failed.") @@ -149,7 +149,7 @@ thread_count = 5 testing_queue = Queue.Queue(thread_count) - if test_support.verbose: + if support.verbose: print() print("*** Testing multiple thread creation "\ "(will take approx. %s to %s sec.) ***" % (DELAY, thread_count)) @@ -161,7 +161,7 @@ _thread.start_new_thread(queue_mark, (testing_queue, local_delay)) time.sleep(DELAY) - if test_support.verbose: + if support.verbose: print('done') self.failUnless(testing_queue.qsize() == thread_count, "Not all %s threads executed properly after %s sec." % @@ -172,10 +172,10 @@ if imported_module: _thread = imported_module DELAY = 2 - if test_support.verbose: + if support.verbose: print() print("*** Using %s as _thread module ***" % _thread) - test_support.run_unittest(LockTests, MiscTests, ThreadTests) + support.run_unittest(LockTests, MiscTests, ThreadTests) if __name__ == '__main__': test_main() Index: Lib/test/test_xml_etree_c.py =================================================================== --- Lib/test/test_xml_etree_c.py (revision 62293) +++ Lib/test/test_xml_etree_c.py (working copy) @@ -3,7 +3,7 @@ import doctest import sys -from test import test_support +from test import support from xml.etree import cElementTree as ET @@ -214,7 +214,7 @@ def test_main(): from test import test_xml_etree_c - test_support.run_doctest(test_xml_etree_c, verbosity=True) + support.run_doctest(test_xml_etree_c, verbosity=True) if __name__ == '__main__': test_main() Index: Lib/test/test_datetime.py =================================================================== --- Lib/test/test_datetime.py (revision 62293) +++ Lib/test/test_datetime.py (working copy) @@ -7,7 +7,7 @@ import pickle import unittest -from test import test_support +from test import support from datetime import MINYEAR, MAXYEAR from datetime import timedelta @@ -3340,7 +3340,7 @@ self.assertEqual(datetime_sc, as_datetime) def test_main(): - test_support.run_unittest(__name__) + support.run_unittest(__name__) if __name__ == "__main__": test_main() Index: Lib/test/test_future3.py =================================================================== --- Lib/test/test_future3.py (revision 62293) +++ Lib/test/test_future3.py (working copy) @@ -2,7 +2,7 @@ from __future__ import division import unittest -from test import test_support +from test import support x = 2 def nester(): @@ -24,7 +24,7 @@ self.assertEqual(nester(), 3) def test_main(): - test_support.run_unittest(TestFuture) + support.run_unittest(TestFuture) if __name__ == "__main__": test_main() Index: Lib/test/test_scriptpackages.py =================================================================== --- Lib/test/test_scriptpackages.py (revision 62293) +++ Lib/test/test_scriptpackages.py (working copy) @@ -1,7 +1,7 @@ # Copyright (C) 2003 Python Software Foundation import unittest -from test import test_support +from test import support import aetools class TestScriptpackages(unittest.TestCase): @@ -42,7 +42,7 @@ self._test_scriptpackage('CodeWarrior') def test_main(): - test_support.run_unittest(TestScriptpackages) + support.run_unittest(TestScriptpackages) if __name__ == '__main__': Index: Lib/test/test_decorators.py =================================================================== --- Lib/test/test_decorators.py (revision 62293) +++ Lib/test/test_decorators.py (working copy) @@ -1,5 +1,5 @@ import unittest -from test import test_support +from test import support def funcattrs(**kwds): def decorate(func): @@ -302,8 +302,8 @@ self.assertEqual(C.extra, 'second') def test_main(): - test_support.run_unittest(TestDecorators) - test_support.run_unittest(TestClassDecorators) + support.run_unittest(TestDecorators) + support.run_unittest(TestClassDecorators) if __name__=="__main__": test_main() Index: Lib/test/test_wsgiref.py =================================================================== --- Lib/test/test_wsgiref.py (revision 62293) +++ Lib/test/test_wsgiref.py (working copy) @@ -11,7 +11,7 @@ from SocketServer import BaseServer import re, sys -from test import test_support +from test import support class MockServer(WSGIServer): """Non-socket HTTP server""" @@ -578,7 +578,7 @@ # This epilogue is needed for compatibility with the Python 2.5 regrtest module def test_main(): - test_support.run_unittest(__name__) + support.run_unittest(__name__) if __name__ == "__main__": test_main() Index: Lib/test/test_index.py =================================================================== --- Lib/test/test_index.py (revision 62293) +++ Lib/test/test_index.py (working copy) @@ -1,7 +1,7 @@ import unittest -from test import test_support +from test import support import operator -maxsize = test_support.MAX_Py_ssize_t +maxsize = support.MAX_Py_ssize_t minsize = -maxsize-1 class oldstyle: @@ -193,7 +193,7 @@ def test_main(): - test_support.run_unittest( + support.run_unittest( BaseTestCase, ListTestCase, TupleTestCase, Index: Lib/test/test_fileio.py =================================================================== --- Lib/test/test_fileio.py (revision 62293) +++ Lib/test/test_fileio.py (working copy) @@ -6,7 +6,7 @@ from array import array from weakref import proxy -from test.test_support import TESTFN, findfile, run_unittest +from test.support import TESTFN, findfile, run_unittest from collections import UserList import _fileio Index: Lib/test/test_contextlib.py =================================================================== --- Lib/test/test_contextlib.py (revision 62293) +++ Lib/test/test_contextlib.py (working copy) @@ -9,7 +9,7 @@ import unittest import threading from contextlib import * # Tests __all__ -from test import test_support +from test import support class ContextManagerTestCase(unittest.TestCase): @@ -332,7 +332,7 @@ # This is needed to make the test actually run under regrtest.py! def test_main(): - test_support.run_unittest(__name__) + support.run_unittest(__name__) if __name__ == "__main__": test_main() Index: Lib/test/test_macpath.py =================================================================== --- Lib/test/test_macpath.py (revision 62293) +++ Lib/test/test_macpath.py (working copy) @@ -1,5 +1,5 @@ import macpath -from test import test_support +from test import support import unittest @@ -56,7 +56,7 @@ def test_main(): - test_support.run_unittest(MacPathTestCase) + support.run_unittest(MacPathTestCase) if __name__ == "__main__": Index: Lib/test/test_fnmatch.py =================================================================== --- Lib/test/test_fnmatch.py (revision 62293) +++ Lib/test/test_fnmatch.py (working copy) @@ -1,6 +1,6 @@ """Test cases for the fnmatch module.""" -from test import test_support +from test import support import unittest from fnmatch import fnmatch, fnmatchcase @@ -39,7 +39,7 @@ def test_main(): - test_support.run_unittest(FnmatchTestCase) + support.run_unittest(FnmatchTestCase) if __name__ == "__main__": Index: Lib/test/test_pipes.py =================================================================== --- Lib/test/test_pipes.py (revision 62293) +++ Lib/test/test_pipes.py (working copy) @@ -2,7 +2,7 @@ import os import string import unittest -from test.test_support import TESTFN, run_unittest, unlink, TestSkipped +from test.support import TESTFN, run_unittest, unlink, TestSkipped if os.name != 'posix': raise TestSkipped('pipes module only works on posix') Index: Lib/test/test_module.py =================================================================== --- Lib/test/test_module.py (revision 62293) +++ Lib/test/test_module.py (working copy) @@ -1,6 +1,6 @@ # Test the module type import unittest -from test.test_support import run_unittest +from test.support import run_unittest import sys ModuleType = type(sys) Index: Lib/test/test_dictcomps.py =================================================================== --- Lib/test/test_dictcomps.py (revision 62293) +++ Lib/test/test_dictcomps.py (working copy) @@ -36,16 +36,16 @@ def test_main(verbose=None): import sys - from test import test_support + from test import support from test import test_dictcomps - test_support.run_doctest(test_dictcomps, verbose) + support.run_doctest(test_dictcomps, verbose) # verify reference counting if verbose and hasattr(sys, "gettotalrefcount"): import gc counts = [None] * 5 for i in range(len(counts)): - test_support.run_doctest(test_dictcomps, verbose) + support.run_doctest(test_dictcomps, verbose) gc.collect() counts[i] = sys.gettotalrefcount() print(counts) Index: Lib/test/test_unicode_file.py =================================================================== --- Lib/test/test_unicode_file.py (revision 62293) +++ Lib/test/test_unicode_file.py (working copy) @@ -5,8 +5,8 @@ import unicodedata import unittest -from test.test_support import run_unittest, TestSkipped, TESTFN_UNICODE -from test.test_support import TESTFN_ENCODING, TESTFN_UNICODE_UNENCODEABLE +from test.support import run_unittest, TestSkipped, TESTFN_UNICODE +from test.support import TESTFN_ENCODING, TESTFN_UNICODE_UNENCODEABLE try: TESTFN_UNICODE.encode(TESTFN_ENCODING) except (UnicodeError, TypeError): Index: Lib/test/test_grammar.py =================================================================== --- Lib/test/test_grammar.py (revision 62293) +++ Lib/test/test_grammar.py (working copy) @@ -8,7 +8,7 @@ # regression test, the filterwarnings() call has been added to # regrtest.py. -from test.test_support import run_unittest, check_syntax_error +from test.support import run_unittest, check_syntax_error import unittest import sys # testing import * Index: Lib/test/test_normalization.py =================================================================== --- Lib/test/test_normalization.py (revision 62293) +++ Lib/test/test_normalization.py (working copy) @@ -1,4 +1,4 @@ -from test.test_support import run_unittest, open_urlresource +from test.support import run_unittest, open_urlresource import unittest import sys Index: Lib/test/test_shelve.py =================================================================== --- Lib/test/test_shelve.py (revision 62293) +++ Lib/test/test_shelve.py (working copy) @@ -1,7 +1,7 @@ import unittest import shelve import glob -from test import test_support +from test import support from collections import MutableMapping from test.test_anydbm import dbm_iterator @@ -45,7 +45,7 @@ def tearDown(self): for f in glob.glob(self.fn+"*"): - test_support.unlink(f) + support.unlink(f) def test_ascii_file_shelf(self): s = shelve.open(self.fn, protocol=0) @@ -133,7 +133,7 @@ self._db = [] if not self._in_mem: for f in glob.glob(self.fn+"*"): - test_support.unlink(f) + support.unlink(f) class TestAsciiFileShelve(TestShelveBase): _args={'protocol':0} @@ -156,7 +156,7 @@ def test_main(): for module in dbm_iterator(): - test_support.run_unittest( + support.run_unittest( TestAsciiFileShelve, TestBinaryFileShelve, TestProto2FileShelve, Index: Lib/test/test_codecmaps_jp.py =================================================================== --- Lib/test/test_codecmaps_jp.py (revision 62293) +++ Lib/test/test_codecmaps_jp.py (working copy) @@ -4,7 +4,7 @@ # Codec mapping tests for Japanese encodings # -from test import test_support +from test import support from test import test_multibytecodec_support import unittest @@ -61,7 +61,7 @@ def test_main(): - test_support.run_unittest(__name__) + support.run_unittest(__name__) if __name__ == "__main__": test_main() Index: Lib/test/test_largefile.py =================================================================== --- Lib/test/test_largefile.py (revision 62293) +++ Lib/test/test_largefile.py (working copy) @@ -5,7 +5,7 @@ import stat import sys import unittest -from test.test_support import run_unittest, TESTFN, verbose, requires, \ +from test.support import run_unittest, TESTFN, verbose, requires, \ TestSkipped, unlink try: Index: Lib/test/test_pwd.py =================================================================== --- Lib/test/test_pwd.py (revision 62293) +++ Lib/test/test_pwd.py (working copy) @@ -1,5 +1,5 @@ import unittest -from test import test_support +from test import support import pwd @@ -91,7 +91,7 @@ self.assertRaises(KeyError, pwd.getpwuid, fakeuid) def test_main(): - test_support.run_unittest(PwdTest) + support.run_unittest(PwdTest) if __name__ == "__main__": test_main() Index: Lib/test/test_mutants.py =================================================================== --- Lib/test/test_mutants.py (revision 62293) +++ Lib/test/test_mutants.py (working copy) @@ -1,4 +1,4 @@ -from test.test_support import verbose, TESTFN +from test.support import verbose, TESTFN import random import os Index: Lib/test/test_decimal.py =================================================================== --- Lib/test/test_decimal.py (revision 62293) +++ Lib/test/test_decimal.py (working copy) @@ -31,7 +31,7 @@ import pickle, copy import unittest from decimal import * -from test.test_support import (TestSkipped, run_unittest, run_doctest, +from test.support import (TestSkipped, run_unittest, run_doctest, is_resource_enabled) import random try: Index: Lib/test/test_difflib.py =================================================================== --- Lib/test/test_difflib.py (revision 62293) +++ Lib/test/test_difflib.py (working copy) @@ -1,5 +1,5 @@ import difflib -from test.test_support import run_unittest, findfile +from test.support import run_unittest, findfile import unittest import doctest import sys Index: Lib/test/test_commands.py =================================================================== --- Lib/test/test_commands.py (revision 62293) +++ Lib/test/test_commands.py (working copy) @@ -5,7 +5,7 @@ import unittest import os, tempfile, re -from test.test_support import TestSkipped, run_unittest, reap_children +from test.support import TestSkipped, run_unittest, reap_children from commands import * # The module says: Index: Lib/test/test_wave.py =================================================================== --- Lib/test/test_wave.py (revision 62293) +++ Lib/test/test_wave.py (working copy) @@ -1,4 +1,4 @@ -from test.test_support import TESTFN, run_unittest +from test.support import TESTFN, run_unittest import os import wave import unittest Index: Lib/test/test_tempfile.py =================================================================== --- Lib/test/test_tempfile.py (revision 62293) +++ Lib/test/test_tempfile.py (working copy) @@ -7,7 +7,7 @@ import warnings import unittest -from test import test_support +from test import support warnings.filterwarnings("ignore", category=RuntimeWarning, @@ -116,7 +116,7 @@ self.failIf(s in dict) dict[s] = 1 - def test_supports_iter(self): + def supports_iter(self): # _RandomNameSequence supports the iterator protocol i = 0 @@ -276,7 +276,7 @@ if not has_spawnl: return # ugh, can't use TestSkipped. - if test_support.verbose: + if support.verbose: v="v" else: v="q" @@ -881,7 +881,7 @@ test_classes.append(test_TemporaryFile) def test_main(): - test_support.run_unittest(*test_classes) + support.run_unittest(*test_classes) if __name__ == "__main__": test_main() Index: Lib/test/test_bisect.py =================================================================== --- Lib/test/test_bisect.py (revision 62293) +++ Lib/test/test_bisect.py (working copy) @@ -1,6 +1,6 @@ import sys import unittest -from test import test_support +from test import support from collections import UserList # We do a bit of trickery here to be able to test both the C implementation @@ -286,15 +286,15 @@ TestInsortPython, TestInsortC, TestErrorHandlingPython, TestErrorHandlingC] - test_support.run_unittest(*test_classes) - test_support.run_doctest(test_bisect, verbose) + support.run_unittest(*test_classes) + support.run_doctest(test_bisect, verbose) # verify reference counting if verbose and hasattr(sys, "gettotalrefcount"): import gc counts = [None] * 5 for i in range(len(counts)): - test_support.run_unittest(*test_classes) + support.run_unittest(*test_classes) gc.collect() counts[i] = sys.gettotalrefcount() print(counts) Index: Lib/test/test_threaded_import.py =================================================================== --- Lib/test/test_threaded_import.py (revision 62293) +++ Lib/test/test_threaded_import.py (working copy) @@ -6,7 +6,7 @@ # randrange, and then Python hangs. import thread -from test.test_support import verbose, TestSkipped, TestFailed +from test.support import verbose, TestSkipped, TestFailed critical_section = thread.allocate_lock() done = thread.allocate_lock() Index: Lib/test/test_multibytecodec.py =================================================================== --- Lib/test/test_multibytecodec.py (revision 62293) +++ Lib/test/test_multibytecodec.py (working copy) @@ -4,9 +4,9 @@ # Unit test for multibytecodec itself # -from test import test_support +from test import support from test import test_multibytecodec_support -from test.test_support import TESTFN +from test.support import TESTFN import unittest, io, codecs, sys, os ALL_CJKENCODINGS = [ @@ -51,7 +51,7 @@ print('# coding:', enc, file=io.open(TESTFN, 'w')) exec(open(TESTFN).read()) finally: - test_support.unlink(TESTFN) + support.unlink(TESTFN) class Test_IncrementalEncoder(unittest.TestCase): @@ -151,7 +151,7 @@ finally: f.close() finally: - test_support.unlink(TESTFN) + support.unlink(TESTFN) class Test_StreamWriter(unittest.TestCase): if len('\U00012345') == 2: # UCS2 @@ -235,7 +235,7 @@ myunichr(x).encode('iso_2022_jp', 'ignore') def test_main(): - test_support.run_unittest(__name__) + support.run_unittest(__name__) if __name__ == "__main__": test_main() Index: Lib/test/test_ftplib.py =================================================================== --- Lib/test/test_ftplib.py (revision 62293) +++ Lib/test/test_ftplib.py (working copy) @@ -4,9 +4,9 @@ import time from unittest import TestCase -from test import test_support +from test import support -HOST = test_support.HOST +HOST = support.HOST # This function sets the evt 3 times: # 1) when the connection is ready to be accepted. @@ -37,7 +37,7 @@ self.evt = threading.Event() self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.sock.settimeout(3) - self.port = test_support.bind_port(self.sock) + self.port = support.bind_port(self.sock) threading.Thread(target=server, args=(self.evt,self.sock)).start() # Wait for the server to be ready. self.evt.wait() @@ -106,7 +106,7 @@ def test_main(verbose=None): - test_support.run_unittest(GeneralTests) + support.run_unittest(GeneralTests) if __name__ == '__main__': test_main() Index: Lib/test/test_random.py =================================================================== --- Lib/test/test_random.py (revision 62293) +++ Lib/test/test_random.py (working copy) @@ -6,7 +6,7 @@ import pickle import warnings from math import log, exp, sqrt, pi -from test import test_support +from test import support class TestBasicOps(unittest.TestCase): # Superclass with tests common to all generators. @@ -118,7 +118,7 @@ ("randv2_64.pck", 866), ("randv3.pck", 343)] for file, value in files: - f = open(test_support.findfile(file),"rb") + f = open(support.findfile(file),"rb") r = pickle.load(f) f.close() self.assertEqual(r.randrange(1000), value) @@ -474,14 +474,14 @@ else: testclasses.append(SystemRandom_TestBasicOps) - test_support.run_unittest(*testclasses) + support.run_unittest(*testclasses) # verify reference counting import sys if verbose and hasattr(sys, "gettotalrefcount"): counts = [None] * 5 for i in range(len(counts)): - test_support.run_unittest(*testclasses) + support.run_unittest(*testclasses) counts[i] = sys.gettotalrefcount() print(counts) Index: Lib/test/test_codecencodings_tw.py =================================================================== --- Lib/test/test_codecencodings_tw.py (revision 62293) +++ Lib/test/test_codecencodings_tw.py (working copy) @@ -4,7 +4,7 @@ # Codec encoding tests for ROC encodings. # -from test import test_support +from test import support from test import test_multibytecodec_support import unittest @@ -21,7 +21,7 @@ ) def test_main(): - test_support.run_unittest(__name__) + support.run_unittest(__name__) if __name__ == "__main__": test_main() Index: Lib/test/test_pep292.py =================================================================== --- Lib/test/test_pep292.py (revision 62293) +++ Lib/test/test_pep292.py (working copy) @@ -185,9 +185,9 @@ def test_main(): - from test import test_support + from test import support test_classes = [TestTemplate,] - test_support.run_unittest(*test_classes) + support.run_unittest(*test_classes) if __name__ == '__main__': Index: Lib/test/test_telnetlib.py =================================================================== --- Lib/test/test_telnetlib.py (revision 62293) +++ Lib/test/test_telnetlib.py (working copy) @@ -4,9 +4,9 @@ import time from unittest import TestCase -from test import test_support +from test import support -HOST = test_support.HOST +HOST = support.HOST def server(evt, serv): serv.listen(5) @@ -25,7 +25,7 @@ self.evt = threading.Event() self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.sock.settimeout(3) - self.port = test_support.bind_port(self.sock) + self.port = support.bind_port(self.sock) threading.Thread(target=server, args=(self.evt,self.sock)).start() self.evt.wait() self.evt.clear() @@ -71,7 +71,7 @@ def test_main(verbose=None): - test_support.run_unittest(GeneralTests) + support.run_unittest(GeneralTests) if __name__ == '__main__': test_main() Index: Lib/test/test_base64.py =================================================================== --- Lib/test/test_base64.py (revision 62293) +++ Lib/test/test_base64.py (working copy) @@ -1,5 +1,5 @@ import unittest -from test import test_support +from test import support import base64 import binascii @@ -188,7 +188,7 @@ def test_main(): - test_support.run_unittest(__name__) + support.run_unittest(__name__) if __name__ == '__main__': test_main() Index: Lib/test/test_struct.py =================================================================== --- Lib/test/test_struct.py (revision 62293) +++ Lib/test/test_struct.py (working copy) @@ -1,5 +1,5 @@ -from test.test_support import TestFailed, verbose, verify, vereq -import test.test_support +from test.support import TestFailed, verbose, verify, vereq +import test.support import struct import array import warnings @@ -50,7 +50,7 @@ def with_warning_restore(func): def _with_warning_restore(*args, **kw): - with test.test_support.catch_warning(): + with test.support.catch_warning(): # Grrr, we need this function to warn every time. Without removing # the warningregistry, running test_tarfile then test_struct would fail # on 64-bit platforms. Index: Lib/test/test_weakref.py =================================================================== --- Lib/test/test_weakref.py (revision 62293) +++ Lib/test/test_weakref.py (working copy) @@ -4,7 +4,7 @@ import collections import weakref -from test import test_support +from test import support # Used in ReferencesTestCase.test_ref_created_during_del() . ref_from_del = None @@ -1145,13 +1145,13 @@ __test__ = {'libreftest' : libreftest} def test_main(): - test_support.run_unittest( + support.run_unittest( ReferencesTestCase, MappingTestCase, WeakValueDictionaryTestCase, WeakKeyDictionaryTestCase, ) - test_support.run_doctest(sys.modules[__name__]) + support.run_doctest(sys.modules[__name__]) if __name__ == "__main__": Index: Lib/test/test_enumerate.py =================================================================== --- Lib/test/test_enumerate.py (revision 62293) +++ Lib/test/test_enumerate.py (working copy) @@ -1,7 +1,7 @@ import unittest import sys -from test import test_support +from test import support class G: 'Sequence using __getitem__' @@ -199,14 +199,14 @@ def test_main(verbose=None): testclasses = (EnumerateTestCase, SubclassTestCase, TestEmpty, TestBig, TestReversed) - test_support.run_unittest(*testclasses) + support.run_unittest(*testclasses) # verify reference counting import sys if verbose and hasattr(sys, "gettotalrefcount"): counts = [None] * 5 for i in range(len(counts)): - test_support.run_unittest(*testclasses) + support.run_unittest(*testclasses) counts[i] = sys.gettotalrefcount() print(counts) Index: Lib/test/test_codecencodings_cn.py =================================================================== --- Lib/test/test_codecencodings_cn.py (revision 62293) +++ Lib/test/test_codecencodings_cn.py (working copy) @@ -4,7 +4,7 @@ # Codec encoding tests for PRC encodings. # -from test import test_support +from test import support from test import test_multibytecodec_support import unittest @@ -51,7 +51,7 @@ has_iso10646 = True def test_main(): - test_support.run_unittest(__name__) + support.run_unittest(__name__) if __name__ == "__main__": test_main() Index: Lib/test/test_subprocess.py =================================================================== --- Lib/test/test_subprocess.py (revision 62293) +++ Lib/test/test_subprocess.py (working copy) @@ -1,5 +1,5 @@ import unittest -from test import test_support +from test import support import subprocess import sys import signal @@ -31,14 +31,14 @@ def setUp(self): # Try to minimize the number of children we have so this test # doesn't crash on some buildbots (Alphas in particular). - if hasattr(test_support, "reap_children"): - test_support.reap_children() + if hasattr(support, "reap_children"): + support.reap_children() def tearDown(self): # Try to minimize the number of children we have so this test # doesn't crash on some buildbots (Alphas in particular). - if hasattr(test_support, "reap_children"): - test_support.reap_children() + if hasattr(support, "reap_children"): + support.reap_children() def mkstemp(self): """wrapper for mkstemp, calling mktemp if mkstemp is not available""" @@ -392,8 +392,8 @@ def test_no_leaking(self): # Make sure we leak no resources - if (not hasattr(test_support, "is_resource_enabled") or - test_support.is_resource_enabled("subprocess") and not mswindows): + if (not hasattr(support, "is_resource_enabled") or + support.is_resource_enabled("subprocess") and not mswindows): max_handles = 1026 # too much for most UNIX systems else: max_handles = 65 @@ -657,9 +657,9 @@ def test_main(): - test_support.run_unittest(ProcessTestCase) - if hasattr(test_support, "reap_children"): - test_support.reap_children() + support.run_unittest(ProcessTestCase) + if hasattr(support, "reap_children"): + support.reap_children() if __name__ == "__main__": unittest.main() # XXX test_main() Index: Lib/test/string_tests.py =================================================================== --- Lib/test/string_tests.py (revision 62293) +++ Lib/test/string_tests.py (working copy) @@ -3,7 +3,7 @@ """ import unittest, string, sys, struct -from test import test_support +from test import support from collections import UserList class Sequence: Index: Lib/test/test_old_mailbox.py =================================================================== --- Lib/test/test_old_mailbox.py (revision 62293) +++ Lib/test/test_old_mailbox.py (working copy) @@ -5,11 +5,11 @@ import os import time import unittest -from test import test_support +from test import support # cleanup earlier tests try: - os.unlink(test_support.TESTFN) + os.unlink(support.TESTFN) except os.error: pass @@ -26,7 +26,7 @@ def setUp(self): # create a new maildir mailbox to work with: - self._dir = test_support.TESTFN + self._dir = support.TESTFN os.mkdir(self._dir) os.mkdir(os.path.join(self._dir, "cur")) os.mkdir(os.path.join(self._dir, "tmp")) @@ -66,14 +66,14 @@ def test_empty_maildir(self): """Test an empty maildir mailbox""" # Test for regression on bug #117490: - self.mbox = mailbox.Maildir(test_support.TESTFN) + self.mbox = mailbox.Maildir(support.TESTFN) self.assertEqual(len(self.mbox), 0) self.assert_(self.mbox.next() is None) self.assert_(self.mbox.next() is None) def test_nonempty_maildir_cur(self): self.createMessage("cur") - self.mbox = mailbox.Maildir(test_support.TESTFN) + self.mbox = mailbox.Maildir(support.TESTFN) self.assertEqual(len(self.mbox), 1) self.assert_(self.mbox.next() is not None) self.assert_(self.mbox.next() is None) @@ -81,7 +81,7 @@ def test_nonempty_maildir_new(self): self.createMessage("new") - self.mbox = mailbox.Maildir(test_support.TESTFN) + self.mbox = mailbox.Maildir(support.TESTFN) self.assertEqual(len(self.mbox), 1) self.assert_(self.mbox.next() is not None) self.assert_(self.mbox.next() is None) @@ -90,7 +90,7 @@ def test_nonempty_maildir_both(self): self.createMessage("cur") self.createMessage("new") - self.mbox = mailbox.Maildir(test_support.TESTFN) + self.mbox = mailbox.Maildir(support.TESTFN) self.assertEqual(len(self.mbox), 2) self.assert_(self.mbox.next() is not None) self.assert_(self.mbox.next() is not None) @@ -113,7 +113,7 @@ class MboxTestCase(unittest.TestCase): def setUp(self): # create a new maildir mailbox to work with: - self._path = test_support.TESTFN + self._path = support.TESTFN def tearDown(self): os.unlink(self._path) @@ -147,7 +147,7 @@ def test_main(): - test_support.run_unittest(MaildirTestCase, MboxTestCase) + support.run_unittest(MaildirTestCase, MboxTestCase) if __name__ == "__main__": Index: Lib/test/test_pep3120.py =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: Lib/test/test_bool.py =================================================================== --- Lib/test/test_bool.py (revision 62293) +++ Lib/test/test_bool.py (working copy) @@ -1,7 +1,7 @@ # Test properties of bool promised by PEP 285 import unittest -from test import test_support +from test import support import os @@ -26,14 +26,14 @@ def test_print(self): try: - fo = open(test_support.TESTFN, "w") + fo = open(support.TESTFN, "w") print(False, True, file=fo) fo.close() - fo = open(test_support.TESTFN, "r") + fo = open(support.TESTFN, "r") self.assertEqual(fo.read(), 'False True\n') finally: fo.close() - os.remove(test_support.TESTFN) + os.remove(support.TESTFN) def test_repr(self): self.assertEqual(repr(False), 'False') @@ -234,12 +234,12 @@ def test_fileclosed(self): try: - f = open(test_support.TESTFN, "w") + f = open(support.TESTFN, "w") self.assertIs(f.closed, False) f.close() self.assertIs(f.closed, True) finally: - os.remove(test_support.TESTFN) + os.remove(support.TESTFN) def test_operator(self): import operator @@ -331,7 +331,7 @@ self.assertEqual(str(e_bool), str(e_len)) def test_main(): - test_support.run_unittest(BoolTest) + support.run_unittest(BoolTest) if __name__ == "__main__": test_main() Index: Lib/test/test_range.py =================================================================== --- Lib/test/test_range.py (revision 62293) +++ Lib/test/test_range.py (working copy) @@ -1,6 +1,6 @@ # Python test set -- built-in functions -import test.test_support, unittest +import test.support, unittest import sys import warnings @@ -62,7 +62,7 @@ self.assertEqual(repr(range(1, 2, 3)), 'range(1, 2, 3)') def test_main(): - test.test_support.run_unittest(RangeTest) + test.support.run_unittest(RangeTest) if __name__ == "__main__": test_main() Index: Lib/test/test_zipimport.py =================================================================== --- Lib/test/test_zipimport.py (revision 62293) +++ Lib/test/test_zipimport.py (working copy) @@ -8,7 +8,7 @@ import zlib # implied prerequisite from zipfile import ZipFile, ZipInfo, ZIP_STORED, ZIP_DEFLATED -from test import test_support +from test import support from test.test_importhooks import ImportHooksBaseTestCase, test_src, test_co import zipimport @@ -353,12 +353,12 @@ self.assertZipFailure('A' * 33000) def testEmptyFile(self): - test_support.unlink(TESTMOD) + support.unlink(TESTMOD) open(TESTMOD, 'w+').close() self.assertZipFailure(TESTMOD) def testFileUnreadable(self): - test_support.unlink(TESTMOD) + support.unlink(TESTMOD) fd = os.open(TESTMOD, os.O_CREAT, 000) try: os.close(fd) @@ -367,10 +367,10 @@ # If we leave "the read-only bit" set on Windows, nothing can # delete TESTMOD, and later tests suffer bogus failures. os.chmod(TESTMOD, 0o666) - test_support.unlink(TESTMOD) + support.unlink(TESTMOD) def testNotZipFile(self): - test_support.unlink(TESTMOD) + support.unlink(TESTMOD) fp = open(TESTMOD, 'w+') fp.write('a' * 22) fp.close() @@ -378,7 +378,7 @@ # XXX: disabled until this works on Big-endian machines def _testBogusZipFile(self): - test_support.unlink(TESTMOD) + support.unlink(TESTMOD) fp = open(TESTMOD, 'w+') fp.write(struct.pack('=I', 0x06054B50)) fp.write('a' * 18) @@ -419,13 +419,13 @@ def test_main(): cleanup() try: - test_support.run_unittest( + support.run_unittest( UncompressedZipImportTestCase, CompressedZipImportTestCase, BadFileZipImportTestCase, ) finally: - test_support.unlink(TESTMOD) + support.unlink(TESTMOD) if __name__ == "__main__": test_main() Index: Lib/test/test_cmd_line_script.py =================================================================== --- Lib/test/test_cmd_line_script.py (revision 62293) +++ Lib/test/test_cmd_line_script.py (working copy) @@ -5,7 +5,7 @@ import os import os.path import sys -import test.test_support +import test.support import tempfile import subprocess import py_compile @@ -13,9 +13,9 @@ import shutil import zipfile -verbose = test.test_support.verbose +verbose = test.support.verbose -# XXX ncoghlan: Should we consider moving these to test_support? +# XXX ncoghlan: Should we consider moving these to support? from test.test_cmd_line import _spawn_python, _kill_python def _run_python(*args): @@ -177,8 +177,8 @@ def test_main(): - test.test_support.run_unittest(CmdLineTest) - test.test_support.reap_children() + test.support.run_unittest(CmdLineTest) + test.support.reap_children() if __name__ == '__main__': test_main() Index: Lib/test/test_slice.py =================================================================== --- Lib/test/test_slice.py (revision 62293) +++ Lib/test/test_slice.py (working copy) @@ -1,7 +1,7 @@ # tests for slice objects; in particular the indices method. import unittest -from test import test_support +from test import support from pickle import loads, dumps import sys @@ -115,7 +115,7 @@ self.assertNotEqual(id(s), id(t)) def test_main(): - test_support.run_unittest(SliceTest) + support.run_unittest(SliceTest) if __name__ == "__main__": test_main() Index: Lib/test/test_coding.py =================================================================== --- Lib/test/test_coding.py (revision 62293) +++ Lib/test/test_coding.py (working copy) @@ -1,6 +1,6 @@ -import test.test_support, unittest -from test.test_support import TESTFN +import test.support, unittest +from test.support import TESTFN import os, sys class CodingTest(unittest.TestCase): @@ -50,7 +50,7 @@ sys.path.pop(0) def test_main(): - test.test_support.run_unittest(CodingTest) + test.support.run_unittest(CodingTest) if __name__ == "__main__": test_main() Index: Lib/test/test_uuid.py =================================================================== --- Lib/test/test_uuid.py (revision 62293) +++ Lib/test/test_uuid.py (working copy) @@ -1,5 +1,5 @@ from unittest import TestCase -from test import test_support +from test import support import uuid def importable(name): @@ -462,7 +462,7 @@ def test_main(): - test_support.run_unittest(TestUUID) + support.run_unittest(TestUUID) if __name__ == '__main__': test_main() Index: Lib/test/test_import.py =================================================================== --- Lib/test/test_import.py (revision 62293) +++ Lib/test/test_import.py (working copy) @@ -1,4 +1,4 @@ -from test.test_support import TESTFN, run_unittest, catch_warning +from test.support import TESTFN, run_unittest, catch_warning import unittest import os @@ -8,7 +8,7 @@ import py_compile import warnings import imp -from test.test_support import unlink, TESTFN, unload +from test.support import unlink, TESTFN, unload def remove_files(name): @@ -146,13 +146,13 @@ def test_import_name_binding(self): # import x.y.z binds x in the current namespace import test as x - import test.test_support + import test.support self.assert_(x is test, x.__name__) - self.assert_(hasattr(test.test_support, "__file__")) + self.assert_(hasattr(test.support, "__file__")) # import x.y.z as w binds z as w - import test.test_support as y - self.assert_(y is test.test_support, y.__name__) + import test.support as y + self.assert_(y is test.support, y.__name__) def test_import_initless_directory_warning(self): with catch_warning(): Index: Lib/test/test_anydbm.py =================================================================== --- Lib/test/test_anydbm.py (revision 62293) +++ Lib/test/test_anydbm.py (working copy) @@ -7,9 +7,9 @@ import unittest import anydbm import glob -from test import test_support +from test import support -_fname = test_support.TESTFN +_fname = support.TESTFN _all_modules = [] @@ -121,7 +121,7 @@ def test_main(): try: for module in dbm_iterator(): - test_support.run_unittest(AnyDBMTestCase) + support.run_unittest(AnyDBMTestCase) finally: delete_files() Index: Lib/test/test_netrc.py =================================================================== --- Lib/test/test_netrc.py (revision 62293) +++ Lib/test/test_netrc.py (working copy) @@ -1,6 +1,6 @@ import netrc, os, unittest, sys -from test import test_support +from test import support TEST_NETRC = """ machine foo login log1 password pass1 account acct1 @@ -17,7 +17,7 @@ """ -temp_filename = test_support.TESTFN +temp_filename = support.TESTFN class NetrcTestCase(unittest.TestCase): @@ -41,7 +41,7 @@ self.assert_(nrc.hosts['default'] == ('log2', None, 'pass2')) def test_main(): - test_support.run_unittest(NetrcTestCase) + support.run_unittest(NetrcTestCase) if __name__ == "__main__": test_main() Index: Lib/test/test_unittest.py =================================================================== --- Lib/test/test_unittest.py (revision 62293) +++ Lib/test/test_unittest.py (working copy) @@ -6,7 +6,7 @@ TestCase.{assert,fail}* methods (some are tested implicitly) """ -from test import test_support +from test import support import unittest from unittest import TestCase import types @@ -2289,7 +2289,7 @@ ###################################################################### def test_main(): - test_support.run_unittest(Test_TestCase, Test_TestLoader, + support.run_unittest(Test_TestCase, Test_TestLoader, Test_TestSuite, Test_TestResult, Test_FunctionTestCase, Test_Assertions) Index: Lib/test/test_glob.py =================================================================== --- Lib/test/test_glob.py (revision 62293) +++ Lib/test/test_glob.py (working copy) @@ -1,5 +1,5 @@ import unittest -from test.test_support import run_unittest, TESTFN +from test.support import run_unittest, TESTFN import glob import os import shutil Index: Lib/test/test_gettext.py =================================================================== --- Lib/test/test_gettext.py (revision 62293) +++ Lib/test/test_gettext.py (working copy) @@ -4,7 +4,7 @@ import gettext import unittest -from test import test_support +from test import support # TODO: @@ -338,7 +338,7 @@ def test_main(): - test_support.run_unittest(__name__) + support.run_unittest(__name__) if __name__ == '__main__': test_main() Index: Lib/test/test_platform.py =================================================================== --- Lib/test/test_platform.py (revision 62293) +++ Lib/test/test_platform.py (working copy) @@ -1,5 +1,5 @@ import unittest -from test import test_support +from test import support import platform class PlatformTest(unittest.TestCase): @@ -71,7 +71,7 @@ res = platform.libc_ver(executable) def test_main(): - test_support.run_unittest( + support.run_unittest( PlatformTest ) Index: Lib/test/test_property.py =================================================================== --- Lib/test/test_property.py (revision 62293) +++ Lib/test/test_property.py (working copy) @@ -2,7 +2,7 @@ # more tests are in test_descr import unittest -from test.test_support import run_unittest +from test.support import run_unittest class PropertyBase(Exception): pass Index: Lib/test/test_bytes.py =================================================================== --- Lib/test/test_bytes.py (revision 62293) +++ Lib/test/test_bytes.py (working copy) @@ -13,7 +13,7 @@ import tempfile import unittest import warnings -import test.test_support +import test.support import test.string_tests import test.buffer_tests @@ -969,13 +969,13 @@ def test_main(): - test.test_support.run_unittest(BytesTest) - test.test_support.run_unittest(ByteArrayTest) - test.test_support.run_unittest(AssortedBytesTest) - test.test_support.run_unittest(BytesAsStringTest) - test.test_support.run_unittest(ByteArrayAsStringTest) - test.test_support.run_unittest(ByteArraySubclassTest) - test.test_support.run_unittest(BytearrayPEP3137Test) + test.support.run_unittest(BytesTest) + test.support.run_unittest(ByteArrayTest) + test.support.run_unittest(AssortedBytesTest) + test.support.run_unittest(BytesAsStringTest) + test.support.run_unittest(ByteArrayAsStringTest) + test.support.run_unittest(ByteArraySubclassTest) + test.support.run_unittest(BytearrayPEP3137Test) if __name__ == "__main__": test_main() Index: Lib/test/test_timeout.py =================================================================== --- Lib/test/test_timeout.py (revision 62293) +++ Lib/test/test_timeout.py (working copy) @@ -1,10 +1,10 @@ """Unit tests for socket timeout feature.""" import unittest -from test import test_support +from test import support # This requires the 'network' resource as given on the regrtest command line. -skip_expected = not test_support.is_resource_enabled('network') +skip_expected = not support.is_resource_enabled('network') import time import socket @@ -191,8 +191,8 @@ def test_main(): - test_support.requires('network') - test_support.run_unittest(CreationTestCase, TimeoutTestCase) + support.requires('network') + support.run_unittest(CreationTestCase, TimeoutTestCase) if __name__ == "__main__": test_main() Index: Lib/test/test_htmllib.py =================================================================== --- Lib/test/test_htmllib.py (revision 62293) +++ Lib/test/test_htmllib.py (working copy) @@ -2,7 +2,7 @@ import htmllib import unittest -from test import test_support +from test import support class AnchorCollector(htmllib.HTMLParser): @@ -62,7 +62,7 @@ ]) def test_main(): - test_support.run_unittest(HTMLParserTestCase) + support.run_unittest(HTMLParserTestCase) if __name__ == "__main__": Index: Lib/test/test_time.py =================================================================== --- Lib/test/test_time.py (revision 62293) +++ Lib/test/test_time.py (working copy) @@ -1,4 +1,4 @@ -from test import test_support +from test import support import time import unittest @@ -219,7 +219,7 @@ self.assert_(0 <= (t1-t0) < 0.2) def test_main(): - test_support.run_unittest(TimeTestCase) + support.run_unittest(TimeTestCase) if __name__ == "__main__": Index: Lib/test/test_future4.py =================================================================== --- Lib/test/test_future4.py (revision 62293) +++ Lib/test/test_future4.py (working copy) @@ -1,7 +1,7 @@ from __future__ import unicode_literals import unittest -from test import test_support +from test import support def test_main(): pass Index: Lib/test/test_structmembers.py =================================================================== --- Lib/test/test_structmembers.py (revision 62293) +++ Lib/test/test_structmembers.py (working copy) @@ -6,7 +6,7 @@ LLONG_MAX, LLONG_MIN, ULLONG_MAX import warnings, unittest, sys -from test import test_support +from test import support ts=test_structmembersType(False, 1, 2, 3, 4, 5, 6, 7, 8, 9.99999, 10.1010101010) @@ -69,32 +69,32 @@ self.assertEqual(w.category, RuntimeWarning) def test_byte_max(self): - with test_support.catch_warning() as w: + with support.catch_warning() as w: ts.T_BYTE = CHAR_MAX+1 self.has_warned(w) def test_byte_min(self): - with test_support.catch_warning() as w: + with support.catch_warning() as w: ts.T_BYTE = CHAR_MIN-1 self.has_warned(w) def test_ubyte_max(self): - with test_support.catch_warning() as w: + with support.catch_warning() as w: ts.T_UBYTE = UCHAR_MAX+1 self.has_warned(w) def test_short_max(self): - with test_support.catch_warning() as w: + with support.catch_warning() as w: ts.T_SHORT = SHRT_MAX+1 self.has_warned(w) def test_short_min(self): - with test_support.catch_warning() as w: + with support.catch_warning() as w: ts.T_SHORT = SHRT_MIN-1 self.has_warned(w) def test_ushort_max(self): - with test_support.catch_warning() as w: + with support.catch_warning() as w: ts.T_USHORT = USHRT_MAX+1 self.has_warned(w) @@ -107,7 +107,7 @@ del globals()['__warningregistry__'] if hasattr(sys, '__warningregistry__'): del sys.__warningregistry__ - test_support.run_unittest(__name__) + support.run_unittest(__name__) if __name__ == "__main__": test_main(verbose=True) Index: Lib/test/test_sqlite.py =================================================================== --- Lib/test/test_sqlite.py (revision 62293) +++ Lib/test/test_sqlite.py (working copy) @@ -1,4 +1,4 @@ -from test.test_support import run_unittest, TestSkipped +from test.support import run_unittest, TestSkipped try: import _sqlite3 Index: Lib/test/test_posix.py =================================================================== --- Lib/test/test_posix.py (revision 62293) +++ Lib/test/test_posix.py (working copy) @@ -1,11 +1,11 @@ "Test posix functions" -from test import test_support +from test import support try: import posix except ImportError: - raise test_support.TestSkipped("posix is not available") + raise support.TestSkipped("posix is not available") import time import os @@ -19,11 +19,11 @@ def setUp(self): # create empty file - fp = open(test_support.TESTFN, 'w+') + fp = open(support.TESTFN, 'w+') fp.close() def tearDown(self): - os.unlink(test_support.TESTFN) + os.unlink(support.TESTFN) def testNoArgFunctions(self): # test posix functions which take no arguments and have @@ -46,7 +46,7 @@ def test_fstatvfs(self): if hasattr(posix, 'fstatvfs'): - fp = open(test_support.TESTFN) + fp = open(support.TESTFN) try: self.assert_(posix.fstatvfs(fp.fileno())) finally: @@ -54,7 +54,7 @@ def test_ftruncate(self): if hasattr(posix, 'ftruncate'): - fp = open(test_support.TESTFN, 'w+') + fp = open(support.TESTFN, 'w+') try: # we need to have some data to truncate fp.write('test') @@ -65,7 +65,7 @@ def test_dup(self): if hasattr(posix, 'dup'): - fp = open(test_support.TESTFN) + fp = open(support.TESTFN) try: fd = posix.dup(fp.fileno()) self.assert_(isinstance(fd, int)) @@ -80,8 +80,8 @@ def test_dup2(self): if hasattr(posix, 'dup2'): - fp1 = open(test_support.TESTFN) - fp2 = open(test_support.TESTFN) + fp1 = open(support.TESTFN) + fp2 = open(support.TESTFN) try: posix.dup2(fp1.fileno(), fp2.fileno()) finally: @@ -89,7 +89,7 @@ fp2.close() def fdopen_helper(self, *args): - fd = os.open(test_support.TESTFN, os.O_RDONLY) + fd = os.open(support.TESTFN, os.O_RDONLY) fp2 = posix.fdopen(fd, *args) fp2.close() @@ -101,38 +101,38 @@ def test_osexlock(self): if hasattr(posix, "O_EXLOCK"): - fd = os.open(test_support.TESTFN, + fd = os.open(support.TESTFN, os.O_WRONLY|os.O_EXLOCK|os.O_CREAT) - self.assertRaises(OSError, os.open, test_support.TESTFN, + self.assertRaises(OSError, os.open, support.TESTFN, os.O_WRONLY|os.O_EXLOCK|os.O_NONBLOCK) os.close(fd) if hasattr(posix, "O_SHLOCK"): - fd = os.open(test_support.TESTFN, + fd = os.open(support.TESTFN, os.O_WRONLY|os.O_SHLOCK|os.O_CREAT) - self.assertRaises(OSError, os.open, test_support.TESTFN, + self.assertRaises(OSError, os.open, support.TESTFN, os.O_WRONLY|os.O_EXLOCK|os.O_NONBLOCK) os.close(fd) def test_osshlock(self): if hasattr(posix, "O_SHLOCK"): - fd1 = os.open(test_support.TESTFN, + fd1 = os.open(support.TESTFN, os.O_WRONLY|os.O_SHLOCK|os.O_CREAT) - fd2 = os.open(test_support.TESTFN, + fd2 = os.open(support.TESTFN, os.O_WRONLY|os.O_SHLOCK|os.O_CREAT) os.close(fd2) os.close(fd1) if hasattr(posix, "O_EXLOCK"): - fd = os.open(test_support.TESTFN, + fd = os.open(support.TESTFN, os.O_WRONLY|os.O_SHLOCK|os.O_CREAT) - self.assertRaises(OSError, os.open, test_support.TESTFN, + self.assertRaises(OSError, os.open, support.TESTFN, os.O_RDONLY|os.O_EXLOCK|os.O_NONBLOCK) os.close(fd) def test_fstat(self): if hasattr(posix, 'fstat'): - fp = open(test_support.TESTFN) + fp = open(support.TESTFN) try: self.assert_(posix.fstat(fp.fileno())) finally: @@ -140,16 +140,16 @@ def test_stat(self): if hasattr(posix, 'stat'): - self.assert_(posix.stat(test_support.TESTFN)) + self.assert_(posix.stat(support.TESTFN)) if hasattr(posix, 'chown'): def test_chown(self): # raise an OSError if the file does not exist - os.unlink(test_support.TESTFN) - self.assertRaises(OSError, posix.chown, test_support.TESTFN, -1, -1) + os.unlink(support.TESTFN) + self.assertRaises(OSError, posix.chown, support.TESTFN, -1, -1) # re-create the file - open(test_support.TESTFN, 'w').close() + open(support.TESTFN, 'w').close() if os.getuid() == 0: try: # Many linux distros have a nfsnobody user as MAX_UID-2 @@ -158,29 +158,29 @@ # This part of the test only runs when run as root. # Only scary people run their tests as root. ent = pwd.getpwnam('nfsnobody') - posix.chown(test_support.TESTFN, ent.pw_uid, ent.pw_gid) + posix.chown(support.TESTFN, ent.pw_uid, ent.pw_gid) except KeyError: pass else: # non-root cannot chown to root, raises OSError self.assertRaises(OSError, posix.chown, - test_support.TESTFN, 0, 0) + support.TESTFN, 0, 0) # test a successful chown call - posix.chown(test_support.TESTFN, os.getuid(), os.getgid()) + posix.chown(support.TESTFN, os.getuid(), os.getgid()) def test_chdir(self): if hasattr(posix, 'chdir'): posix.chdir(os.curdir) - self.assertRaises(OSError, posix.chdir, test_support.TESTFN) + self.assertRaises(OSError, posix.chdir, support.TESTFN) def test_lsdir(self): if hasattr(posix, 'lsdir'): - self.assert_(test_support.TESTFN in posix.lsdir(os.curdir)) + self.assert_(support.TESTFN in posix.lsdir(os.curdir)) def test_access(self): if hasattr(posix, 'access'): - self.assert_(posix.access(test_support.TESTFN, os.R_OK)) + self.assert_(posix.access(support.TESTFN, os.R_OK)) def test_umask(self): if hasattr(posix, 'umask'): @@ -201,24 +201,24 @@ def test_utime(self): if hasattr(posix, 'utime'): now = time.time() - posix.utime(test_support.TESTFN, None) - self.assertRaises(TypeError, posix.utime, test_support.TESTFN, (None, None)) - self.assertRaises(TypeError, posix.utime, test_support.TESTFN, (now, None)) - self.assertRaises(TypeError, posix.utime, test_support.TESTFN, (None, now)) - posix.utime(test_support.TESTFN, (int(now), int(now))) - posix.utime(test_support.TESTFN, (now, now)) + posix.utime(support.TESTFN, None) + self.assertRaises(TypeError, posix.utime, support.TESTFN, (None, None)) + self.assertRaises(TypeError, posix.utime, support.TESTFN, (now, None)) + self.assertRaises(TypeError, posix.utime, support.TESTFN, (None, now)) + posix.utime(support.TESTFN, (int(now), int(now))) + posix.utime(support.TESTFN, (now, now)) def test_chflags(self): if hasattr(posix, 'chflags'): - st = os.stat(test_support.TESTFN) + st = os.stat(support.TESTFN) if hasattr(st, 'st_flags'): - posix.chflags(test_support.TESTFN, st.st_flags) + posix.chflags(support.TESTFN, st.st_flags) def test_lchflags(self): if hasattr(posix, 'lchflags'): - st = os.stat(test_support.TESTFN) + st = os.stat(support.TESTFN) if hasattr(st, 'st_flags'): - posix.lchflags(test_support.TESTFN, st.st_flags) + posix.lchflags(support.TESTFN, st.st_flags) def test_environ(self): for k, v in posix.environ.items(): @@ -226,7 +226,7 @@ self.assertEqual(type(v), str) def test_main(): - test_support.run_unittest(PosixTester) + support.run_unittest(PosixTester) if __name__ == '__main__': test_main() Index: Lib/test/test_curses.py =================================================================== --- Lib/test/test_curses.py (revision 62293) +++ Lib/test/test_curses.py (working copy) @@ -16,7 +16,7 @@ # 'curses' resource be given on the regrtest command line using the -u # option. If not available, nothing after this line will be executed. -from test.test_support import requires, TestSkipped +from test.support import requires, TestSkipped requires('curses') # XXX: if newterm was supported we could use it instead of initscr and not exit Index: Lib/test/test___all__.py =================================================================== --- Lib/test/test___all__.py (revision 62293) +++ Lib/test/test___all__.py (working copy) @@ -1,5 +1,5 @@ import unittest -from test.test_support import run_unittest +from test.support import run_unittest import sys Index: Lib/test/test_fcntl.py =================================================================== --- Lib/test/test_fcntl.py (revision 62293) +++ Lib/test/test_fcntl.py (working copy) @@ -8,7 +8,7 @@ import struct import sys import unittest -from test.test_support import verbose, TESTFN, unlink, run_unittest +from test.support import verbose, TESTFN, unlink, run_unittest # TODO - Write tests for flock() and lockf(). Index: Lib/test/test_binop.py =================================================================== --- Lib/test/test_binop.py (revision 62293) +++ Lib/test/test_binop.py (working copy) @@ -1,7 +1,7 @@ """Tests for binary operators on subtypes of built-in types.""" import unittest -from test import test_support +from test import support def gcd(a, b): """Greatest common divisor using Euclid's algorithm.""" @@ -317,7 +317,7 @@ """ def test_main(): - test_support.run_unittest(RatTestCase) + support.run_unittest(RatTestCase) if __name__ == "__main__": Index: Lib/test/test_copy.py =================================================================== --- Lib/test/test_copy.py (revision 62293) +++ Lib/test/test_copy.py (working copy) @@ -4,7 +4,7 @@ import copy_reg import unittest -from test import test_support +from test import support class TestCopy(unittest.TestCase): @@ -50,7 +50,7 @@ def __reduce_ex__(self, proto): return "" def __reduce__(self): - raise test_support.TestFailed("shouldn't call this") + raise support.TestFailed("shouldn't call this") x = C() y = copy.copy(x) self.assert_(y is x) @@ -223,7 +223,7 @@ def __reduce_ex__(self, proto): return "" def __reduce__(self): - raise test_support.TestFailed("shouldn't call this") + raise support.TestFailed("shouldn't call this") x = C() y = copy.deepcopy(x) self.assert_(y is x) @@ -584,7 +584,7 @@ def global_foo(x, y): return x+y def test_main(): - test_support.run_unittest(TestCopy) + support.run_unittest(TestCopy) if __name__ == "__main__": test_main() Index: Lib/test/test_modulefinder.py =================================================================== --- Lib/test/test_modulefinder.py (revision 62293) +++ Lib/test/test_modulefinder.py (working copy) @@ -4,7 +4,7 @@ import distutils.dir_util import tempfile -from test import test_support +from test import support try: set except NameError: from sets import Set as set @@ -258,7 +258,7 @@ def test_main(): distutils.log.set_threshold(distutils.log.WARN) - test_support.run_unittest(ModuleFinderTest) + support.run_unittest(ModuleFinderTest) if __name__ == "__main__": unittest.main() Index: Lib/test/test_select.py =================================================================== --- Lib/test/test_select.py (revision 62293) +++ Lib/test/test_select.py (working copy) @@ -1,4 +1,4 @@ -from test import test_support +from test import support import unittest import select import os @@ -21,23 +21,23 @@ def test_select(self): if sys.platform[:3] in ('win', 'mac', 'os2', 'riscos'): - if test_support.verbose: + if support.verbose: print("Can't test select easily on", sys.platform) return cmd = 'for i in 0 1 2 3 4 5 6 7 8 9; do echo testing...; sleep 1; done' p = os.popen(cmd, 'r') for tout in (0, 1, 2, 4, 8, 16) + (None,)*10: - if test_support.verbose: + if support.verbose: print('timeout =', tout) rfd, wfd, xfd = select.select([p], [], [], tout) if (rfd, wfd, xfd) == ([], [], []): continue if (rfd, wfd, xfd) == ([p], [], []): line = p.readline() - if test_support.verbose: + if support.verbose: print(repr(line)) if not line: - if test_support.verbose: + if support.verbose: print('EOF') break continue @@ -45,8 +45,8 @@ p.close() def test_main(): - test_support.run_unittest(SelectTestCase) - test_support.reap_children() + support.run_unittest(SelectTestCase) + support.reap_children() if __name__ == "__main__": test_main() Index: Lib/test/test_threading_local.py =================================================================== --- Lib/test/test_threading_local.py (revision 62293) +++ Lib/test/test_threading_local.py (working copy) @@ -1,6 +1,6 @@ import unittest from doctest import DocTestSuite -from test import test_support +from test import support import threading import weakref import gc @@ -62,7 +62,7 @@ setUp=setUp, tearDown=tearDown) ) - test_support.run_unittest(suite) + support.run_unittest(suite) if __name__ == '__main__': test_main() Index: Lib/test/test_hash.py =================================================================== --- Lib/test/test_hash.py (revision 62293) +++ Lib/test/test_hash.py (working copy) @@ -3,7 +3,7 @@ # import unittest -from test import test_support +from test import support class HashEqualityTestCase(unittest.TestCase): @@ -38,7 +38,7 @@ def test_main(): - test_support.run_unittest(HashEqualityTestCase) + support.run_unittest(HashEqualityTestCase) if __name__ == "__main__": Index: Lib/test/test_richcmp.py =================================================================== --- Lib/test/test_richcmp.py (revision 62293) +++ Lib/test/test_richcmp.py (working copy) @@ -1,7 +1,7 @@ # Tests for rich comparisons import unittest -from test import test_support +from test import support import operator @@ -29,7 +29,7 @@ return self.x >= other def __cmp__(self, other): - raise test_support.TestFailed("Number.__cmp__() should not be called") + raise support.TestFailed("Number.__cmp__() should not be called") def __repr__(self): return "Number(%r)" % (self.x, ) @@ -55,7 +55,7 @@ raise TypeError("Vectors cannot be used in Boolean contexts") def __cmp__(self, other): - raise test_support.TestFailed("Vector.__cmp__() should not be called") + raise support.TestFailed("Vector.__cmp__() should not be called") def __repr__(self): return "Vector(%r)" % (self.data, ) @@ -387,11 +387,11 @@ self.assertEquals(str(e), "unhashable type: 'DumbEqualityWithoutHash'") else: - raise test_support.TestFailed("Should not be here") + raise support.TestFailed("Should not be here") def test_main(): - test_support.run_unittest(VectorTest, NumberTest, MiscTest, DictTest, ListTest, HashableTest) + support.run_unittest(VectorTest, NumberTest, MiscTest, DictTest, ListTest, HashableTest) if __name__ == "__main__": test_main() Index: Lib/test/test_grp.py =================================================================== --- Lib/test/test_grp.py (revision 62293) +++ Lib/test/test_grp.py (working copy) @@ -2,7 +2,7 @@ import grp import unittest -from test import test_support +from test import support class GroupDatabaseTestCase(unittest.TestCase): @@ -86,7 +86,7 @@ self.assertRaises(KeyError, grp.getgrgid, fakegid) def test_main(): - test_support.run_unittest(GroupDatabaseTestCase) + support.run_unittest(GroupDatabaseTestCase) if __name__ == "__main__": test_main() Index: Lib/test/test_urllib.py =================================================================== --- Lib/test/test_urllib.py (revision 62293) +++ Lib/test/test_urllib.py (working copy) @@ -4,7 +4,7 @@ import httplib import io import unittest -from test import test_support +from test import support import os import mimetools import tempfile @@ -27,18 +27,18 @@ def setUp(self): """Setup of a temp file to use for testing""" self.text = bytes("test_urllib: %s\n" % self.__class__.__name__, "ascii") - FILE = open(test_support.TESTFN, 'wb') + FILE = open(support.TESTFN, 'wb') try: FILE.write(self.text) finally: FILE.close() - self.pathname = test_support.TESTFN + self.pathname = support.TESTFN self.returned_obj = urllib.urlopen("file:%s" % self.pathname) def tearDown(self): """Shut down the open object""" self.returned_obj.close() - os.remove(test_support.TESTFN) + os.remove(support.TESTFN) def test_interface(self): # Make sure object returned by urlopen() has the specified methods @@ -163,10 +163,10 @@ self.tempFiles = [] # Create a temporary file. - self.registerFileForCleanUp(test_support.TESTFN) + self.registerFileForCleanUp(support.TESTFN) self.text = b'testing urllib.urlretrieve' try: - FILE = open(test_support.TESTFN, 'wb') + FILE = open(support.TESTFN, 'wb') FILE.write(self.text) FILE.close() finally: @@ -204,18 +204,18 @@ def test_basic(self): # Make sure that a local file just gets its own location returned and # a headers value is returned. - result = urllib.urlretrieve("file:%s" % test_support.TESTFN) - self.assertEqual(result[0], test_support.TESTFN) + result = urllib.urlretrieve("file:%s" % support.TESTFN) + self.assertEqual(result[0], support.TESTFN) self.assert_(isinstance(result[1], mimetools.Message), "did not get a mimetools.Message instance as second " "returned value") def test_copy(self): # Test that setting the filename argument works. - second_temp = "%s.2" % test_support.TESTFN + second_temp = "%s.2" % support.TESTFN self.registerFileForCleanUp(second_temp) result = urllib.urlretrieve(self.constructLocalFileUrl( - test_support.TESTFN), second_temp) + support.TESTFN), second_temp) self.assertEqual(second_temp, result[0]) self.assert_(os.path.exists(second_temp), "copy of the file was not " "made") @@ -236,9 +236,9 @@ self.assert_(isinstance(total_size, int)) self.assertEqual(count, count_holder[0]) count_holder[0] = count_holder[0] + 1 - second_temp = "%s.2" % test_support.TESTFN + second_temp = "%s.2" % support.TESTFN self.registerFileForCleanUp(second_temp) - urllib.urlretrieve(self.constructLocalFileUrl(test_support.TESTFN), + urllib.urlretrieve(self.constructLocalFileUrl(support.TESTFN), second_temp, hooktester) def test_reporthook_0_bytes(self): @@ -248,7 +248,7 @@ _report.append((count, block_size, total_size)) srcFileName = self.createNewTempFile() urllib.urlretrieve(self.constructLocalFileUrl(srcFileName), - test_support.TESTFN, hooktester) + support.TESTFN, hooktester) self.assertEqual(len(report), 1) self.assertEqual(report[0][2], 0) @@ -262,7 +262,7 @@ _report.append((count, block_size, total_size)) srcFileName = self.createNewTempFile(b"x" * 5) urllib.urlretrieve(self.constructLocalFileUrl(srcFileName), - test_support.TESTFN, hooktester) + support.TESTFN, hooktester) self.assertEqual(len(report), 2) self.assertEqual(report[0][1], 8192) self.assertEqual(report[0][2], 5) @@ -276,7 +276,7 @@ _report.append((count, block_size, total_size)) srcFileName = self.createNewTempFile(b"x" * 8193) urllib.urlretrieve(self.constructLocalFileUrl(srcFileName), - test_support.TESTFN, hooktester) + support.TESTFN, hooktester) self.assertEqual(len(report), 3) self.assertEqual(report[0][1], 8192) self.assertEqual(report[0][2], 8193) @@ -632,7 +632,7 @@ def test_main(): - test_support.run_unittest( + support.run_unittest( urlopen_FileTests, urlopen_HttpTests, urlretrieve_FileTests, Index: Lib/test/test_mailbox.py =================================================================== --- Lib/test/test_mailbox.py (revision 62293) +++ Lib/test/test_mailbox.py (working copy) @@ -8,7 +8,7 @@ import rfc822 import re import io -from test import test_support +from test import support import unittest import mailbox import glob @@ -53,7 +53,7 @@ _template = 'From: foo\n\n%s' def setUp(self): - self._path = test_support.TESTFN + self._path = support.TESTFN self._delete_recursively(self._path) self._box = self._factory(self._path) @@ -718,7 +718,7 @@ self._box.close() self._delete_recursively(self._path) for lock_remnant in glob.glob(self._path + '.*'): - test_support.unlink(lock_remnant) + support.unlink(lock_remnant) def test_add_from_string(self): # Add a string starting with 'From ' to the mailbox @@ -941,7 +941,7 @@ self._box.close() self._delete_recursively(self._path) for lock_remnant in glob.glob(self._path + '.*'): - test_support.unlink(lock_remnant) + support.unlink(lock_remnant) def test_labels(self): # Get labels from the mailbox @@ -967,7 +967,7 @@ _factory = mailbox.Message # Overridden by subclasses to reuse tests def setUp(self): - self._path = test_support.TESTFN + self._path = support.TESTFN def tearDown(self): self._delete_recursively(self._path) @@ -1583,7 +1583,7 @@ class TestProxyFile(TestProxyFileBase): def setUp(self): - self._path = test_support.TESTFN + self._path = support.TESTFN self._file = open(self._path, 'wb+') def tearDown(self): @@ -1632,7 +1632,7 @@ class TestPartialFile(TestProxyFileBase): def setUp(self): - self._path = test_support.TESTFN + self._path = support.TESTFN self._file = open(self._path, 'wb+') def tearDown(self): @@ -1695,7 +1695,7 @@ def setUp(self): # create a new maildir mailbox to work with: - self._dir = test_support.TESTFN + self._dir = support.TESTFN os.mkdir(self._dir) os.mkdir(os.path.join(self._dir, "cur")) os.mkdir(os.path.join(self._dir, "tmp")) @@ -1736,7 +1736,7 @@ """Test an empty maildir mailbox""" # Test for regression on bug #117490: # Make sure the boxes attribute actually gets set. - self.mbox = mailbox.Maildir(test_support.TESTFN) + self.mbox = mailbox.Maildir(support.TESTFN) #self.assert_(hasattr(self.mbox, "boxes")) #self.assertEqual(len(self.mbox.boxes), 0) self.assert_(self.mbox.next() is None) @@ -1744,7 +1744,7 @@ def test_nonempty_maildir_cur(self): self.createMessage("cur") - self.mbox = mailbox.Maildir(test_support.TESTFN) + self.mbox = mailbox.Maildir(support.TESTFN) #self.assertEqual(len(self.mbox.boxes), 1) self.assert_(self.mbox.next() is not None) self.assert_(self.mbox.next() is None) @@ -1752,7 +1752,7 @@ def test_nonempty_maildir_new(self): self.createMessage("new") - self.mbox = mailbox.Maildir(test_support.TESTFN) + self.mbox = mailbox.Maildir(support.TESTFN) #self.assertEqual(len(self.mbox.boxes), 1) self.assert_(self.mbox.next() is not None) self.assert_(self.mbox.next() is None) @@ -1761,7 +1761,7 @@ def test_nonempty_maildir_both(self): self.createMessage("cur") self.createMessage("new") - self.mbox = mailbox.Maildir(test_support.TESTFN) + self.mbox = mailbox.Maildir(support.TESTFN) #self.assertEqual(len(self.mbox.boxes), 2) self.assert_(self.mbox.next() is not None) self.assert_(self.mbox.next() is not None) @@ -1872,8 +1872,8 @@ TestMHMessage, TestBabylMessage, TestMMDFMessage, TestMessageConversion, TestProxyFile, TestPartialFile, MaildirTestCase) - test_support.run_unittest(*tests) - test_support.reap_children() + support.run_unittest(*tests) + support.reap_children() if __name__ == '__main__': Index: Lib/test/test_sax.py =================================================================== --- Lib/test/test_sax.py (revision 62293) +++ Lib/test/test_sax.py (working copy) @@ -13,7 +13,7 @@ from xml.sax.expatreader import create_parser from xml.sax.xmlreader import InputSource, AttributesImpl, AttributesNSImpl from io import StringIO -from test.test_support import findfile, run_unittest +from test.support import findfile, run_unittest import unittest import os Index: Lib/test/test_urlparse.py =================================================================== --- Lib/test/test_urlparse.py (revision 62293) +++ Lib/test/test_urlparse.py (working copy) @@ -1,6 +1,6 @@ #! /usr/bin/env python -from test import test_support +from test import support import unittest import urlparse @@ -311,7 +311,7 @@ ('http', 'example.com', '', '', 'blahblah=/foo', '')) def test_main(): - test_support.run_unittest(UrlParseTestCase) + support.run_unittest(UrlParseTestCase) if __name__ == "__main__": test_main() Index: Lib/test/test_bigmem.py =================================================================== --- Lib/test/test_bigmem.py (revision 62293) +++ Lib/test/test_bigmem.py (working copy) @@ -1,5 +1,5 @@ -from test import test_support -from test.test_support import bigmemtest, _1G, _2G +from test import support +from test.support import bigmemtest, _1G, _2G import unittest import operator @@ -957,9 +957,9 @@ self.assertEquals(l[-10:], [5] * 10) def test_main(): - test_support.run_unittest(StrTest, TupleTest, ListTest) + support.run_unittest(StrTest, TupleTest, ListTest) if __name__ == '__main__': if len(sys.argv) > 1: - test_support.set_memlimit(sys.argv[1]) + support.set_memlimit(sys.argv[1]) test_main() Index: Lib/test/test_codecencodings_jp.py =================================================================== --- Lib/test/test_codecencodings_jp.py (revision 62293) +++ Lib/test/test_codecencodings_jp.py (working copy) @@ -4,7 +4,7 @@ # Codec encoding tests for Japanese encodings. # -from test import test_support +from test import support from test import test_multibytecodec_support import unittest @@ -99,7 +99,7 @@ ) def test_main(): - test_support.run_unittest(__name__) + support.run_unittest(__name__) if __name__ == "__main__": test_main() Index: Lib/test/test_zipfile.py =================================================================== --- Lib/test/test_zipfile.py (revision 62293) +++ Lib/test/test_zipfile.py (working copy) @@ -8,8 +8,8 @@ from tempfile import TemporaryFile from random import randint, random -import test.test_support as support -from test.test_support import TESTFN, run_unittest +import test.support as support +from test.support import TESTFN, run_unittest TESTFN2 = TESTFN + "2" FIXEDTEST_SIZE = 1000 Index: Lib/test/test_class.py =================================================================== --- Lib/test/test_class.py (revision 62293) +++ Lib/test/test_class.py (working copy) @@ -2,7 +2,7 @@ import unittest -from test import test_support +from test import support testmeths = [ @@ -555,7 +555,7 @@ hash(a.f) def test_main(): - test_support.run_unittest(ClassTests) + support.run_unittest(ClassTests) if __name__=='__main__': test_main() Index: Lib/test/test_cookie.py =================================================================== --- Lib/test/test_cookie.py (revision 62293) +++ Lib/test/test_cookie.py (working copy) @@ -1,6 +1,6 @@ # Simple test suite for Cookie.py -from test.test_support import run_unittest, run_doctest +from test.support import run_unittest, run_doctest import unittest import Cookie Index: Lib/test/test_urllib2.py =================================================================== --- Lib/test/test_urllib2.py (revision 62293) +++ Lib/test/test_urllib2.py (working copy) @@ -1,5 +1,5 @@ import unittest -from test import test_support +from test import support import os import io @@ -588,7 +588,7 @@ h = urllib2.FileHandler() o = h.parent = MockOpener() - TESTFN = test_support.TESTFN + TESTFN = support.TESTFN urlpath = sanepathname2url(os.path.abspath(TESTFN)) towrite = b"hello, world\n" urls = [ @@ -1069,13 +1069,13 @@ def test_main(verbose=None): from test import test_urllib2 - test_support.run_doctest(test_urllib2, verbose) - test_support.run_doctest(urllib2, verbose) + support.run_doctest(test_urllib2, verbose) + support.run_doctest(urllib2, verbose) tests = (TrivialTests, OpenerDirectorTests, HandlerTests, MiscTests) - test_support.run_unittest(*tests) + support.run_unittest(*tests) if __name__ == "__main__": test_main(verbose=True) Index: Lib/test/test_pty.py =================================================================== --- Lib/test/test_pty.py (revision 62293) +++ Lib/test/test_pty.py (working copy) @@ -4,7 +4,7 @@ import os import sys import signal -from test.test_support import verbose, TestSkipped, run_unittest +from test.support import verbose, TestSkipped, run_unittest import unittest TEST_STRING_1 = "I wish to buy a fish license.\n" Index: Lib/test/test_filecmp.py =================================================================== --- Lib/test/test_filecmp.py (revision 62293) +++ Lib/test/test_filecmp.py (working copy) @@ -1,13 +1,13 @@ import os, filecmp, shutil, tempfile, shutil import unittest -from test import test_support +from test import support class FileCompareTestCase(unittest.TestCase): def setUp(self): - self.name = test_support.TESTFN - self.name_same = test_support.TESTFN + '-same' - self.name_diff = test_support.TESTFN + '-diff' + self.name = support.TESTFN + self.name_same = support.TESTFN + '-same' + self.name_diff = support.TESTFN + '-diff' data = 'Contents of file go here.\n' for name in [self.name, self.name_same, self.name_diff]: output = open(name, 'w') @@ -128,7 +128,7 @@ def test_main(): - test_support.run_unittest(FileCompareTestCase, DirCompareTestCase) + support.run_unittest(FileCompareTestCase, DirCompareTestCase) if __name__ == "__main__": test_main() Index: Lib/test/test_augassign.py =================================================================== --- Lib/test/test_augassign.py (revision 62293) +++ Lib/test/test_augassign.py (working copy) @@ -1,6 +1,6 @@ # Augmented assignment test. -from test.test_support import run_unittest +from test.support import run_unittest import unittest Index: Lib/test/test_userdict.py =================================================================== --- Lib/test/test_userdict.py (revision 62293) +++ Lib/test/test_userdict.py (working copy) @@ -1,6 +1,6 @@ # Check every path through every method of UserDict -from test import test_support, mapping_tests +from test import support, mapping_tests import collections d0 = {} @@ -190,7 +190,7 @@ def test_main(): - test_support.run_unittest( + support.run_unittest( UserDictTest, ) Index: Lib/test/test_pickletools.py =================================================================== --- Lib/test/test_pickletools.py (revision 62293) +++ Lib/test/test_pickletools.py (working copy) @@ -1,6 +1,6 @@ import pickle import pickletools -from test import test_support +from test import support from test.pickletester import AbstractPickleTests from test.pickletester import AbstractPickleModuleTests @@ -16,8 +16,8 @@ error = KeyError def test_main(): - test_support.run_unittest(OptimizedPickleTests) - test_support.run_doctest(pickletools) + support.run_unittest(OptimizedPickleTests) + support.run_doctest(pickletools) if __name__ == "__main__": Index: Lib/test/test_startfile.py =================================================================== --- Lib/test/test_startfile.py (revision 62293) +++ Lib/test/test_startfile.py (working copy) @@ -8,7 +8,7 @@ # call succeeded, but also the the script actually has run. import unittest -from test import test_support +from test import support # use this form so that the test is skipped when startfile is not available: from os import startfile, path @@ -23,7 +23,7 @@ startfile(empty, "open") def test_main(): - test_support.run_unittest(TestCase) + support.run_unittest(TestCase) if __name__=="__main__": test_main() Index: Lib/test/test_trace.py =================================================================== --- Lib/test/test_trace.py (revision 62293) +++ Lib/test/test_trace.py (working copy) @@ -1,6 +1,6 @@ # Testing the line trace facility. -from test import test_support +from test import support import unittest import sys import difflib @@ -730,7 +730,7 @@ no_jump_without_trace_function() def test_main(): - test_support.run_unittest( + support.run_unittest( TraceTestCase, RaisingTraceFuncTestCase, JumpTestCase Index: Lib/test/test_dircache.py =================================================================== --- Lib/test/test_dircache.py (revision 62293) +++ Lib/test/test_dircache.py (working copy) @@ -4,7 +4,7 @@ """ import unittest -from test.test_support import run_unittest, TESTFN +from test.support import run_unittest, TESTFN import dircache, os, time, sys, tempfile Index: Lib/test/test_threading.py =================================================================== --- Lib/test/test_threading.py (revision 62293) +++ Lib/test/test_threading.py (working copy) @@ -1,7 +1,7 @@ # Very rudimentary test of threading module -import test.test_support -from test.test_support import verbose +import test.support +from test.support import verbose import random import sys import threading @@ -356,7 +356,7 @@ def test_main(): - test.test_support.run_unittest(ThreadTests, + test.support.run_unittest(ThreadTests, ThreadingExceptionTests) if __name__ == "__main__": Index: Lib/test/test_userstring.py =================================================================== --- Lib/test/test_userstring.py (revision 62293) +++ Lib/test/test_userstring.py (working copy) @@ -3,7 +3,7 @@ # UserString instances should behave similar to builtin string objects. import string -from test import test_support, string_tests +from test import support, string_tests from collections import UserString @@ -43,7 +43,7 @@ def test_main(): - test_support.run_unittest(UserStringTest) + support.run_unittest(UserStringTest) if __name__ == "__main__": test_main() Index: Lib/test/test_builtin.py =================================================================== --- Lib/test/test_builtin.py (revision 62293) +++ Lib/test/test_builtin.py (working copy) @@ -1,7 +1,7 @@ # Python test set -- built-in functions -import test.test_support, unittest -from test.test_support import fcmp, TESTFN, unlink, run_unittest, \ +import test.support, unittest +from test.support import fcmp, TESTFN, unlink, run_unittest, \ run_with_locale from operator import neg Index: Lib/test/test_copy_reg.py =================================================================== --- Lib/test/test_copy_reg.py (revision 62293) +++ Lib/test/test_copy_reg.py (working copy) @@ -1,7 +1,7 @@ import copy_reg import unittest -from test import test_support +from test import support from test.pickletester import ExtensionSaver class C: @@ -114,7 +114,7 @@ def test_main(): - test_support.run_unittest(CopyRegTestCase) + support.run_unittest(CopyRegTestCase) if __name__ == "__main__": Index: Lib/test/test_multibytecodec_support.py =================================================================== --- Lib/test/test_multibytecodec_support.py (revision 62293) +++ Lib/test/test_multibytecodec_support.py (working copy) @@ -6,7 +6,7 @@ import sys, codecs import unittest, re -from test import test_support +from test import support from io import BytesIO class TestBase: @@ -279,10 +279,10 @@ try: self.open_mapping_file() # test it to report the error early except IOError: - raise test_support.TestSkipped("Could not retrieve "+self.mapfileurl) + raise support.TestSkipped("Could not retrieve "+self.mapfileurl) def open_mapping_file(self): - return test_support.open_urlresource(self.mapfileurl) + return support.open_urlresource(self.mapfileurl) def test_mapping_file(self): if self.mapfileurl.endswith('.xml'): Index: Lib/test/test_funcattrs.py =================================================================== --- Lib/test/test_funcattrs.py (revision 62293) +++ Lib/test/test_funcattrs.py (working copy) @@ -1,4 +1,4 @@ -from test import test_support +from test import support import types import unittest @@ -225,7 +225,7 @@ self.assertEqual(self.b.__doc__, None) def test_main(): - test_support.run_unittest(FunctionPropertiesTest, ImplicitReferencesTest, + support.run_unittest(FunctionPropertiesTest, ImplicitReferencesTest, ArbitraryFunctionAttrTest, FunctionDictsTest, FunctionDocstringTest) Index: Lib/test/test_userlist.py =================================================================== --- Lib/test/test_userlist.py (revision 62293) +++ Lib/test/test_userlist.py (working copy) @@ -1,7 +1,7 @@ # Check every path through every method of UserList from collections import UserList -from test import test_support, list_tests +from test import support, list_tests class UserListTest(list_tests.CommonTest): type2test = UserList @@ -53,7 +53,7 @@ self.assertEqual(next(iter(T((1,2)))), "0!!!") def test_main(): - test_support.run_unittest(UserListTest) + support.run_unittest(UserListTest) if __name__ == "__main__": test_main() Index: Lib/test/test_call.py =================================================================== --- Lib/test/test_call.py (revision 62293) +++ Lib/test/test_call.py (working copy) @@ -1,5 +1,5 @@ import unittest -from test import test_support +from test import support # The test cases here cover several paths through the function calling # code. They depend on the METH_XXX flag that is used to define a C @@ -124,7 +124,7 @@ def test_main(): - test_support.run_unittest(CFunctionCalls) + support.run_unittest(CFunctionCalls) if __name__ == "__main__": Index: Lib/test/test_support.py =================================================================== --- Lib/test/test_support.py (revision 62293) +++ Lib/test/test_support.py (working copy) @@ -1,707 +0,0 @@ -"""Supporting definitions for the Python regression tests.""" - -if __name__ != 'test.test_support': - raise ImportError('test_support must be imported from the test package') - -import contextlib -import errno -import socket -import sys -import os -import os.path -import shutil -import warnings -import unittest - -class Error(Exception): - """Base class for regression test exceptions.""" - -class TestFailed(Error): - """Test failed.""" - -class TestSkipped(Error): - """Test skipped. - - This can be raised to indicate that a test was deliberatly - skipped, but not because a feature wasn't available. For - example, if some resource can't be used, such as the network - appears to be unavailable, this should be raised instead of - TestFailed. - """ - -class ResourceDenied(TestSkipped): - """Test skipped because it requested a disallowed resource. - - This is raised when a test calls requires() for a resource that - has not be enabled. It is used to distinguish between expected - and unexpected skips. - """ - -verbose = 1 # Flag set to 0 by regrtest.py -use_resources = None # Flag set to [] by regrtest.py -max_memuse = 0 # Disable bigmem tests (they will still be run with - # small sizes, to make sure they work.) - -# _original_stdout is meant to hold stdout at the time regrtest began. -# This may be "the real" stdout, or IDLE's emulation of stdout, or whatever. -# The point is to have some flavor of stdout the user can actually see. -_original_stdout = None -def record_original_stdout(stdout): - global _original_stdout - _original_stdout = stdout - -def get_original_stdout(): - return _original_stdout or sys.stdout - -def unload(name): - try: - del sys.modules[name] - except KeyError: - pass - -def unlink(filename): - try: - os.unlink(filename) - except OSError: - pass - -def rmtree(path): - try: - shutil.rmtree(path) - except OSError as e: - # Unix returns ENOENT, Windows returns ESRCH. - if e.errno not in (errno.ENOENT, errno.ESRCH): - raise - -def forget(modname): - '''"Forget" a module was ever imported by removing it from sys.modules and - deleting any .pyc and .pyo files.''' - unload(modname) - for dirname in sys.path: - unlink(os.path.join(dirname, modname + '.pyc')) - # Deleting the .pyo file cannot be within the 'try' for the .pyc since - # the chance exists that there is no .pyc (and thus the 'try' statement - # is exited) but there is a .pyo file. - unlink(os.path.join(dirname, modname + '.pyo')) - -def is_resource_enabled(resource): - """Test whether a resource is enabled. Known resources are set by - regrtest.py.""" - return use_resources is not None and resource in use_resources - -def requires(resource, msg=None): - """Raise ResourceDenied if the specified resource is not available. - - If the caller's module is __main__ then automatically return True. The - possibility of False being returned occurs when regrtest.py is executing.""" - # see if the caller's module is __main__ - if so, treat as if - # the resource was set - if sys._getframe().f_back.f_globals.get("__name__") == "__main__": - return - if not is_resource_enabled(resource): - if msg is None: - msg = "Use of the `%s' resource not enabled" % resource - raise ResourceDenied(msg) - -HOST = 'localhost' - -def find_unused_port(family=socket.AF_INET, socktype=socket.SOCK_STREAM): - """Returns an unused port that should be suitable for binding. This is - achieved by creating a temporary socket with the same family and type as - the 'sock' parameter (default is AF_INET, SOCK_STREAM), and binding it to - the specified host address (defaults to 0.0.0.0) with the port set to 0, - eliciting an unused ephemeral port from the OS. The temporary socket is - then closed and deleted, and the ephemeral port is returned. - - Either this method or bind_port() should be used for any tests where a - server socket needs to be bound to a particular port for the duration of - the test. Which one to use depends on whether the calling code is creating - a python socket, or if an unused port needs to be provided in a constructor - or passed to an external program (i.e. the -accept argument to openssl's - s_server mode). Always prefer bind_port() over find_unused_port() where - possible. Hard coded ports should *NEVER* be used. As soon as a server - socket is bound to a hard coded port, the ability to run multiple instances - of the test simultaneously on the same host is compromised, which makes the - test a ticking time bomb in a buildbot environment. On Unix buildbots, this - may simply manifest as a failed test, which can be recovered from without - intervention in most cases, but on Windows, the entire python process can - completely and utterly wedge, requiring someone to log in to the buildbot - and manually kill the affected process. - - (This is easy to reproduce on Windows, unfortunately, and can be traced to - the SO_REUSEADDR socket option having different semantics on Windows versus - Unix/Linux. On Unix, you can't have two AF_INET SOCK_STREAM sockets bind, - listen and then accept connections on identical host/ports. An EADDRINUSE - socket.error will be raised at some point (depending on the platform and - the order bind and listen were called on each socket). - - However, on Windows, if SO_REUSEADDR is set on the sockets, no EADDRINUSE - will ever be raised when attempting to bind two identical host/ports. When - accept() is called on each socket, the second caller's process will steal - the port from the first caller, leaving them both in an awkwardly wedged - state where they'll no longer respond to any signals or graceful kills, and - must be forcibly killed via OpenProcess()/TerminateProcess(). - - The solution on Windows is to use the SO_EXCLUSIVEADDRUSE socket option - instead of SO_REUSEADDR, which effectively affords the same semantics as - SO_REUSEADDR on Unix. Given the propensity of Unix developers in the Open - Source world compared to Windows ones, this is a common mistake. A quick - look over OpenSSL's 0.9.8g source shows that they use SO_REUSEADDR when - openssl.exe is called with the 's_server' option, for example. See - http://bugs.python.org/issue2550 for more info. The following site also - has a very thorough description about the implications of both REUSEADDR - and EXCLUSIVEADDRUSE on Windows: - http://msdn2.microsoft.com/en-us/library/ms740621(VS.85).aspx) - - XXX: although this approach is a vast improvement on previous attempts to - elicit unused ports, it rests heavily on the assumption that the ephemeral - port returned to us by the OS won't immediately be dished back out to some - other process when we close and delete our temporary socket but before our - calling code has a chance to bind the returned port. We can deal with this - issue if/when we come across it. - """ - - tempsock = socket.socket(family, socktype) - port = bind_port(tempsock) - tempsock.close() - del tempsock - return port - -def bind_port(sock, host=HOST): - """Bind the socket to a free port and return the port number. Relies on - ephemeral ports in order to ensure we are using an unbound port. This is - important as many tests may be running simultaneously, especially in a - buildbot environment. This method raises an exception if the sock.family - is AF_INET and sock.type is SOCK_STREAM, *and* the socket has SO_REUSEADDR - or SO_REUSEPORT set on it. Tests should *never* set these socket options - for TCP/IP sockets. The only case for setting these options is testing - multicasting via multiple UDP sockets. - - Additionally, if the SO_EXCLUSIVEADDRUSE socket option is available (i.e. - on Windows), it will be set on the socket. This will prevent anyone else - from bind()'ing to our host/port for the duration of the test. - """ - - if sock.family == socket.AF_INET and sock.type == socket.SOCK_STREAM: - if hasattr(socket, 'SO_REUSEADDR'): - if sock.getsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR) == 1: - raise TestFailed("tests should never set the SO_REUSEADDR " \ - "socket option on TCP/IP sockets!") - if hasattr(socket, 'SO_REUSEPORT'): - if sock.getsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT) == 1: - raise TestFailed("tests should never set the SO_REUSEPORT " \ - "socket option on TCP/IP sockets!") - if hasattr(socket, 'SO_EXCLUSIVEADDRUSE'): - sock.setsockopt(socket.SOL_SOCKET, socket.SO_EXCLUSIVEADDRUSE, 1) - - sock.bind((host, 0)) - port = sock.getsockname()[1] - return port - -FUZZ = 1e-6 - -def fcmp(x, y): # fuzzy comparison function - if isinstance(x, float) or isinstance(y, float): - try: - fuzz = (abs(x) + abs(y)) * FUZZ - if abs(x-y) <= fuzz: - return 0 - except: - pass - elif type(x) == type(y) and isinstance(x, (tuple, list)): - for i in range(min(len(x), len(y))): - outcome = fcmp(x[i], y[i]) - if outcome != 0: - return outcome - return (len(x) > len(y)) - (len(x) < len(y)) - return (x > y) - (x < y) - -try: - str - have_unicode = True -except NameError: - have_unicode = False - -is_jython = sys.platform.startswith('java') - -# Filename used for testing -if os.name == 'java': - # Jython disallows @ in module names - TESTFN = '$test' -else: - TESTFN = '@test' - - # Assuming sys.getfilesystemencoding()!=sys.getdefaultencoding() - # TESTFN_UNICODE is a filename that can be encoded using the - # file system encoding, but *not* with the default (ascii) encoding - TESTFN_UNICODE = "@test-\xe0\xf2" - TESTFN_ENCODING = sys.getfilesystemencoding() - # TESTFN_UNICODE_UNENCODEABLE is a filename that should *not* be - # able to be encoded by *either* the default or filesystem encoding. - # This test really only makes sense on Windows NT platforms - # which have special Unicode support in posixmodule. - if (not hasattr(sys, "getwindowsversion") or - sys.getwindowsversion()[3] < 2): # 0=win32s or 1=9x/ME - TESTFN_UNICODE_UNENCODEABLE = None - else: - # Japanese characters (I think - from bug 846133) - TESTFN_UNICODE_UNENCODEABLE = "@test-\u5171\u6709\u3055\u308c\u308b" - try: - # XXX - Note - should be using TESTFN_ENCODING here - but for - # Windows, "mbcs" currently always operates as if in - # errors=ignore' mode - hence we get '?' characters rather than - # the exception. 'Latin1' operates as we expect - ie, fails. - # See [ 850997 ] mbcs encoding ignores errors - TESTFN_UNICODE_UNENCODEABLE.encode("Latin1") - except UnicodeEncodeError: - pass - else: - print('WARNING: The filename %r CAN be encoded by the filesystem. ' - 'Unicode filename tests may not be effective' - % TESTFN_UNICODE_UNENCODEABLE) - -# Make sure we can write to TESTFN, try in /tmp if we can't -fp = None -try: - fp = open(TESTFN, 'w+') -except IOError: - TMP_TESTFN = os.path.join('/tmp', TESTFN) - try: - fp = open(TMP_TESTFN, 'w+') - TESTFN = TMP_TESTFN - del TMP_TESTFN - except IOError: - print(('WARNING: tests will fail, unable to write to: %s or %s' % - (TESTFN, TMP_TESTFN))) -if fp is not None: - fp.close() - unlink(TESTFN) -del fp - -def findfile(file, here=__file__): - """Try to find a file on sys.path and the working directory. If it is not - found the argument passed to the function is returned (this does not - necessarily signal failure; could still be the legitimate path).""" - if os.path.isabs(file): - return file - path = sys.path - path = [os.path.dirname(here)] + path - for dn in path: - fn = os.path.join(dn, file) - if os.path.exists(fn): return fn - return file - -def verify(condition, reason='test failed'): - """Verify that condition is true. If not, raise TestFailed. - - The optional argument reason can be given to provide - a better error text. - """ - - if not condition: - raise TestFailed(reason) - -def vereq(a, b): - """Raise TestFailed if a == b is false. - - This is better than verify(a == b) because, in case of failure, the - error message incorporates repr(a) and repr(b) so you can see the - inputs. - - Note that "not (a == b)" isn't necessarily the same as "a != b"; the - former is tested. - """ - - if not (a == b): - raise TestFailed("%r == %r" % (a, b)) - -def sortdict(dict): - "Like repr(dict), but in sorted order." - items = sorted(dict.items()) - reprpairs = ["%r: %r" % pair for pair in items] - withcommas = ", ".join(reprpairs) - return "{%s}" % withcommas - -def check_syntax_error(testcase, statement): - try: - compile(statement, '', 'exec') - except SyntaxError: - pass - else: - testcase.fail('Missing SyntaxError: "%s"' % statement) - -def open_urlresource(url, *args, **kw): - import urllib, urlparse - - requires('urlfetch') - filename = urlparse.urlparse(url)[2].split('/')[-1] # '/': it's URL! - - for path in [os.path.curdir, os.path.pardir]: - fn = os.path.join(path, filename) - if os.path.exists(fn): - return open(fn, *args, **kw) - - print('\tfetching %s ...' % url, file=get_original_stdout()) - fn, _ = urllib.urlretrieve(url, filename) - return open(fn, *args, **kw) - - -class WarningMessage(object): - "Holds the result of the latest showwarning() call" - def __init__(self): - self.message = None - self.category = None - self.filename = None - self.lineno = None - - def _showwarning(self, message, category, filename, lineno, file=None): - self.message = message - self.category = category - self.filename = filename - self.lineno = lineno - -@contextlib.contextmanager -def catch_warning(): - """ - Guard the warnings filter from being permanently changed and record the - data of the last warning that has been issued. - - Use like this: - - with catch_warning() as w: - warnings.warn("foo") - assert str(w.message) == "foo" - """ - warning = WarningMessage() - original_filters = warnings.filters[:] - original_showwarning = warnings.showwarning - warnings.showwarning = warning._showwarning - try: - yield warning - finally: - warnings.showwarning = original_showwarning - warnings.filters = original_filters - -class EnvironmentVarGuard(object): - - """Class to help protect the environment variable properly. Can be used as - a context manager.""" - - def __init__(self): - self._environ = os.environ - self._unset = set() - self._reset = dict() - - def set(self, envvar, value): - if envvar not in self._environ: - self._unset.add(envvar) - else: - self._reset[envvar] = self._environ[envvar] - self._environ[envvar] = value - - def unset(self, envvar): - if envvar in self._environ: - self._reset[envvar] = self._environ[envvar] - del self._environ[envvar] - - def __enter__(self): - return self - - def __exit__(self, *ignore_exc): - for envvar, value in self._reset.items(): - self._environ[envvar] = value - for unset in self._unset: - del self._environ[unset] - -class TransientResource(object): - - """Raise ResourceDenied if an exception is raised while the context manager - is in effect that matches the specified exception and attributes.""" - - def __init__(self, exc, **kwargs): - self.exc = exc - self.attrs = kwargs - - def __enter__(self): - return self - - def __exit__(self, type_=None, value=None, traceback=None): - """If type_ is a subclass of self.exc and value has attributes matching - self.attrs, raise ResourceDenied. Otherwise let the exception - propagate (if any).""" - if type_ is not None and issubclass(self.exc, type_): - for attr, attr_value in self.attrs.items(): - if not hasattr(value, attr): - break - if getattr(value, attr) != attr_value: - break - else: - raise ResourceDenied("an optional resource is not available") - - -def transient_internet(): - """Return a context manager that raises ResourceDenied when various issues - with the Internet connection manifest themselves as exceptions.""" - time_out = TransientResource(IOError, errno=errno.ETIMEDOUT) - socket_peer_reset = TransientResource(socket.error, errno=errno.ECONNRESET) - ioerror_peer_reset = TransientResource(IOError, errno=errno.ECONNRESET) - return contextlib.nested(time_out, socket_peer_reset, ioerror_peer_reset) - - -@contextlib.contextmanager -def captured_output(stream_name): - """Run the 'with' statement body using a StringIO object in place of a - specific attribute on the sys module. - Example use (with 'stream_name=stdout'):: - - with captured_stdout() as s: - print "hello" - assert s.getvalue() == "hello" - """ - import io - orig_stdout = getattr(sys, stream_name) - setattr(sys, stream_name, io.StringIO()) - yield getattr(sys, stream_name) - setattr(sys, stream_name, orig_stdout) - -def captured_stdout(): - return captured_output("stdout") - - -#======================================================================= -# Decorator for running a function in a different locale, correctly resetting -# it afterwards. - -def run_with_locale(catstr, *locales): - def decorator(func): - def inner(*args, **kwds): - try: - import locale - category = getattr(locale, catstr) - orig_locale = locale.setlocale(category) - except AttributeError: - # if the test author gives us an invalid category string - raise - except: - # cannot retrieve original locale, so do nothing - locale = orig_locale = None - else: - for loc in locales: - try: - locale.setlocale(category, loc) - break - except: - pass - - # now run the function, resetting the locale on exceptions - try: - return func(*args, **kwds) - finally: - if locale and orig_locale: - locale.setlocale(category, orig_locale) - inner.__name__ = func.__name__ - inner.__doc__ = func.__doc__ - return inner - return decorator - -#======================================================================= -# Big-memory-test support. Separate from 'resources' because memory use -# should be configurable. - -# Some handy shorthands. Note that these are used for byte-limits as well -# as size-limits, in the various bigmem tests -_1M = 1024*1024 -_1G = 1024 * _1M -_2G = 2 * _1G - -MAX_Py_ssize_t = sys.maxsize - -def set_memlimit(limit): - import re - global max_memuse - sizes = { - 'k': 1024, - 'm': _1M, - 'g': _1G, - 't': 1024*_1G, - } - m = re.match(r'(\d+(\.\d+)?) (K|M|G|T)b?$', limit, - re.IGNORECASE | re.VERBOSE) - if m is None: - raise ValueError('Invalid memory limit %r' % (limit,)) - memlimit = int(float(m.group(1)) * sizes[m.group(3).lower()]) - if memlimit > MAX_Py_ssize_t: - memlimit = MAX_Py_ssize_t - if memlimit < _2G - 1: - raise ValueError('Memory limit %r too low to be useful' % (limit,)) - max_memuse = memlimit - -def bigmemtest(minsize, memuse, overhead=5*_1M): - """Decorator for bigmem tests. - - 'minsize' is the minimum useful size for the test (in arbitrary, - test-interpreted units.) 'memuse' is the number of 'bytes per size' for - the test, or a good estimate of it. 'overhead' specifies fixed overhead, - independant of the testsize, and defaults to 5Mb. - - The decorator tries to guess a good value for 'size' and passes it to - the decorated test function. If minsize * memuse is more than the - allowed memory use (as defined by max_memuse), the test is skipped. - Otherwise, minsize is adjusted upward to use up to max_memuse. - """ - def decorator(f): - def wrapper(self): - if not max_memuse: - # If max_memuse is 0 (the default), - # we still want to run the tests with size set to a few kb, - # to make sure they work. We still want to avoid using - # too much memory, though, but we do that noisily. - maxsize = 5147 - self.failIf(maxsize * memuse + overhead > 20 * _1M) - else: - maxsize = int((max_memuse - overhead) / memuse) - if maxsize < minsize: - # Really ought to print 'test skipped' or something - if verbose: - sys.stderr.write("Skipping %s because of memory " - "constraint\n" % (f.__name__,)) - return - # Try to keep some breathing room in memory use - maxsize = max(maxsize - 50 * _1M, minsize) - return f(self, maxsize) - wrapper.minsize = minsize - wrapper.memuse = memuse - wrapper.overhead = overhead - return wrapper - return decorator - -def bigaddrspacetest(f): - """Decorator for tests that fill the address space.""" - def wrapper(self): - if max_memuse < MAX_Py_ssize_t: - if verbose: - sys.stderr.write("Skipping %s because of memory " - "constraint\n" % (f.__name__,)) - else: - return f(self) - return wrapper - -#======================================================================= -# unittest integration. - -class BasicTestRunner: - def run(self, test): - result = unittest.TestResult() - test(result) - return result - - -def _run_suite(suite): - """Run tests from a unittest.TestSuite-derived class.""" - if verbose: - runner = unittest.TextTestRunner(sys.stdout, verbosity=2) - else: - runner = BasicTestRunner() - - result = runner.run(suite) - if not result.wasSuccessful(): - if len(result.errors) == 1 and not result.failures: - err = result.errors[0][1] - elif len(result.failures) == 1 and not result.errors: - err = result.failures[0][1] - else: - err = "errors occurred; run in verbose mode for details" - raise TestFailed(err) - - -def run_unittest(*classes): - """Run tests from unittest.TestCase-derived classes.""" - valid_types = (unittest.TestSuite, unittest.TestCase) - suite = unittest.TestSuite() - for cls in classes: - if isinstance(cls, str): - if cls in sys.modules: - suite.addTest(unittest.findTestCases(sys.modules[cls])) - else: - raise ValueError("str arguments must be keys in sys.modules") - elif isinstance(cls, valid_types): - suite.addTest(cls) - else: - suite.addTest(unittest.makeSuite(cls)) - _run_suite(suite) - - -#======================================================================= -# doctest driver. - -def run_doctest(module, verbosity=None): - """Run doctest on the given module. Return (#failures, #tests). - - If optional argument verbosity is not specified (or is None), pass - test_support's belief about verbosity on to doctest. Else doctest's - usual behavior is used (it searches sys.argv for -v). - """ - - import doctest - - if verbosity is None: - verbosity = verbose - else: - verbosity = None - - # Direct doctest output (normally just errors) to real stdout; doctest - # output shouldn't be compared by regrtest. - save_stdout = sys.stdout - sys.stdout = get_original_stdout() - try: - f, t = doctest.testmod(module, verbose=verbosity) - if f: - raise TestFailed("%d of %d doctests failed" % (f, t)) - finally: - sys.stdout = save_stdout - if verbose: - print('doctest (%s) ... %d tests with zero failures' % - (module.__name__, t)) - return f, t - -#======================================================================= -# Threading support to prevent reporting refleaks when running regrtest.py -R - -def threading_setup(): - import threading - return len(threading._active), len(threading._limbo) - -def threading_cleanup(num_active, num_limbo): - import threading - import time - - _MAX_COUNT = 10 - count = 0 - while len(threading._active) != num_active and count < _MAX_COUNT: - count += 1 - time.sleep(0.1) - - count = 0 - while len(threading._limbo) != num_limbo and count < _MAX_COUNT: - count += 1 - time.sleep(0.1) - -def reap_children(): - """Use this function at the end of test_main() whenever sub-processes - are started. This will help ensure that no extra children (zombies) - stick around to hog resources and create problems when looking - for refleaks. - """ - - # Reap all our dead child processes so we don't leave zombies around. - # These hog resources and might be causing some of the buildbots to die. - if hasattr(os, 'waitpid'): - any_process = -1 - while True: - try: - # This will raise an exception on Windows. That's ok. - pid, status = os.waitpid(any_process, os.WNOHANG) - if pid == 0: - break - except: - break Index: Lib/test/support.py =================================================================== --- Lib/test/support.py (revision 62293) +++ Lib/test/support.py (working copy) @@ -1,7 +1,7 @@ """Supporting definitions for the Python regression tests.""" -if __name__ != 'test.test_support': - raise ImportError('test_support must be imported from the test package') +if __name__ != 'test.support': + raise ImportError('support must be imported from the test package') import contextlib import errno @@ -638,7 +638,7 @@ """Run doctest on the given module. Return (#failures, #tests). If optional argument verbosity is not specified (or is None), pass - test_support's belief about verbosity on to doctest. Else doctest's + support's belief about verbosity on to doctest. Else doctest's usual behavior is used (it searches sys.argv for -v). """ Index: Lib/test/test_collections.py =================================================================== --- Lib/test/test_collections.py (revision 62293) +++ Lib/test/test_collections.py (working copy) @@ -1,7 +1,7 @@ """Unit tests for collections.py.""" import unittest, doctest -from test import test_support +from test import support from collections import namedtuple from collections import Hashable, Iterable, Iterator from collections import Sized, Container, Callable @@ -321,8 +321,8 @@ def test_main(verbose=None): NamedTupleDocs = doctest.DocTestSuite(module=collections) test_classes = [TestNamedTuple, NamedTupleDocs, TestOneTrickPonyABCs, TestCollectionABCs] - test_support.run_unittest(*test_classes) - test_support.run_doctest(collections, verbose) + support.run_unittest(*test_classes) + support.run_doctest(collections, verbose) if __name__ == "__main__": Index: Lib/test/test_sys.py =================================================================== --- Lib/test/test_sys.py (revision 62293) +++ Lib/test/test_sys.py (working copy) @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -import unittest, test.test_support +import unittest, test.support import sys, io class SysModuleTest(unittest.TestCase): @@ -349,7 +349,7 @@ #self.assert_(r[0][2] > 100, r[0][2]) def test_main(): - test.test_support.run_unittest(SysModuleTest) + test.support.run_unittest(SysModuleTest) if __name__ == "__main__": test_main() Index: Lib/test/test_lib2to3.py =================================================================== --- Lib/test/test_lib2to3.py (revision 62293) +++ Lib/test/test_lib2to3.py (working copy) @@ -2,7 +2,7 @@ # because of running from lib2to3.tests import test_fixers, test_pytree, test_util import unittest -from test.test_support import run_unittest +from test.support import run_unittest def suite(): tests = unittest.TestSuite() Index: Lib/test/test_posixpath.py =================================================================== --- Lib/test/test_posixpath.py (revision 62293) +++ Lib/test/test_posixpath.py (working copy) @@ -1,5 +1,5 @@ import unittest -from test import test_support +from test import support import posixpath, os from posixpath import realpath, abspath, join, dirname, basename, relpath @@ -7,7 +7,7 @@ # An absolute path to a temporary filename for testing. We can't rely on TESTFN # being an absolute path, so we need this. -ABSTFN = abspath(test_support.TESTFN) +ABSTFN = abspath(support.TESTFN) def safe_rmdir(dirname): try: @@ -22,8 +22,8 @@ def tearDown(self): for suffix in ["", "1", "2"]: - test_support.unlink(test_support.TESTFN + suffix) - safe_rmdir(test_support.TESTFN + suffix) + support.unlink(support.TESTFN + suffix) + safe_rmdir(support.TESTFN + suffix) def assertIs(self, a, b): self.assert_(a is b) @@ -141,50 +141,50 @@ self.assertNotEqual(s1[n:n+1], s2[n:n+1]) def test_getsize(self): - f = open(test_support.TESTFN, "wb") + f = open(support.TESTFN, "wb") try: f.write(b"foo") f.close() - self.assertEqual(posixpath.getsize(test_support.TESTFN), 3) + self.assertEqual(posixpath.getsize(support.TESTFN), 3) finally: if not f.closed: f.close() def test_time(self): - f = open(test_support.TESTFN, "wb") + f = open(support.TESTFN, "wb") try: f.write(b"foo") f.close() - f = open(test_support.TESTFN, "ab") + f = open(support.TESTFN, "ab") f.write(b"bar") f.close() - f = open(test_support.TESTFN, "rb") + f = open(support.TESTFN, "rb") d = f.read() f.close() self.assertEqual(d, b"foobar") self.assert_( - posixpath.getctime(test_support.TESTFN) <= - posixpath.getmtime(test_support.TESTFN) + posixpath.getctime(support.TESTFN) <= + posixpath.getmtime(support.TESTFN) ) finally: if not f.closed: f.close() def test_islink(self): - self.assertIs(posixpath.islink(test_support.TESTFN + "1"), False) - f = open(test_support.TESTFN + "1", "wb") + self.assertIs(posixpath.islink(support.TESTFN + "1"), False) + f = open(support.TESTFN + "1", "wb") try: f.write(b"foo") f.close() - self.assertIs(posixpath.islink(test_support.TESTFN + "1"), False) + self.assertIs(posixpath.islink(support.TESTFN + "1"), False) if hasattr(os, "symlink"): - os.symlink(test_support.TESTFN + "1", test_support.TESTFN + "2") - self.assertIs(posixpath.islink(test_support.TESTFN + "2"), True) - os.remove(test_support.TESTFN + "1") - self.assertIs(posixpath.islink(test_support.TESTFN + "2"), True) - self.assertIs(posixpath.exists(test_support.TESTFN + "2"), False) - self.assertIs(posixpath.lexists(test_support.TESTFN + "2"), True) + os.symlink(support.TESTFN + "1", support.TESTFN + "2") + self.assertIs(posixpath.islink(support.TESTFN + "2"), True) + os.remove(support.TESTFN + "1") + self.assertIs(posixpath.islink(support.TESTFN + "2"), True) + self.assertIs(posixpath.exists(support.TESTFN + "2"), False) + self.assertIs(posixpath.lexists(support.TESTFN + "2"), True) finally: if not f.close(): f.close() @@ -192,13 +192,13 @@ self.assertRaises(TypeError, posixpath.islink) def test_exists(self): - self.assertIs(posixpath.exists(test_support.TESTFN), False) - f = open(test_support.TESTFN, "wb") + self.assertIs(posixpath.exists(support.TESTFN), False) + f = open(support.TESTFN, "wb") try: f.write(b"foo") f.close() - self.assertIs(posixpath.exists(test_support.TESTFN), True) - self.assertIs(posixpath.lexists(test_support.TESTFN), True) + self.assertIs(posixpath.exists(support.TESTFN), True) + self.assertIs(posixpath.lexists(support.TESTFN), True) finally: if not f.close(): f.close() @@ -206,16 +206,16 @@ self.assertRaises(TypeError, posixpath.exists) def test_isdir(self): - self.assertIs(posixpath.isdir(test_support.TESTFN), False) - f = open(test_support.TESTFN, "wb") + self.assertIs(posixpath.isdir(support.TESTFN), False) + f = open(support.TESTFN, "wb") try: f.write(b"foo") f.close() - self.assertIs(posixpath.isdir(test_support.TESTFN), False) - os.remove(test_support.TESTFN) - os.mkdir(test_support.TESTFN) - self.assertIs(posixpath.isdir(test_support.TESTFN), True) - os.rmdir(test_support.TESTFN) + self.assertIs(posixpath.isdir(support.TESTFN), False) + os.remove(support.TESTFN) + os.mkdir(support.TESTFN) + self.assertIs(posixpath.isdir(support.TESTFN), True) + os.rmdir(support.TESTFN) finally: if not f.close(): f.close() @@ -223,16 +223,16 @@ self.assertRaises(TypeError, posixpath.isdir) def test_isfile(self): - self.assertIs(posixpath.isfile(test_support.TESTFN), False) - f = open(test_support.TESTFN, "wb") + self.assertIs(posixpath.isfile(support.TESTFN), False) + f = open(support.TESTFN, "wb") try: f.write(b"foo") f.close() - self.assertIs(posixpath.isfile(test_support.TESTFN), True) - os.remove(test_support.TESTFN) - os.mkdir(test_support.TESTFN) - self.assertIs(posixpath.isfile(test_support.TESTFN), False) - os.rmdir(test_support.TESTFN) + self.assertIs(posixpath.isfile(support.TESTFN), True) + os.remove(support.TESTFN) + os.mkdir(support.TESTFN) + self.assertIs(posixpath.isfile(support.TESTFN), False) + os.rmdir(support.TESTFN) finally: if not f.close(): f.close() @@ -240,14 +240,14 @@ self.assertRaises(TypeError, posixpath.isdir) def test_samefile(self): - f = open(test_support.TESTFN + "1", "wb") + f = open(support.TESTFN + "1", "wb") try: f.write(b"foo") f.close() self.assertIs( posixpath.samefile( - test_support.TESTFN + "1", - test_support.TESTFN + "1" + support.TESTFN + "1", + support.TESTFN + "1" ), True ) @@ -255,24 +255,24 @@ # inode information and thus, that samefile() doesn't work if hasattr(os, "symlink"): os.symlink( - test_support.TESTFN + "1", - test_support.TESTFN + "2" + support.TESTFN + "1", + support.TESTFN + "2" ) self.assertIs( posixpath.samefile( - test_support.TESTFN + "1", - test_support.TESTFN + "2" + support.TESTFN + "1", + support.TESTFN + "2" ), True ) - os.remove(test_support.TESTFN + "2") - f = open(test_support.TESTFN + "2", "wb") + os.remove(support.TESTFN + "2") + f = open(support.TESTFN + "2", "wb") f.write(b"bar") f.close() self.assertIs( posixpath.samefile( - test_support.TESTFN + "1", - test_support.TESTFN + "2" + support.TESTFN + "1", + support.TESTFN + "2" ), False ) @@ -283,14 +283,14 @@ self.assertRaises(TypeError, posixpath.samefile) def test_samestat(self): - f = open(test_support.TESTFN + "1", "wb") + f = open(support.TESTFN + "1", "wb") try: f.write(b"foo") f.close() self.assertIs( posixpath.samestat( - os.stat(test_support.TESTFN + "1"), - os.stat(test_support.TESTFN + "1") + os.stat(support.TESTFN + "1"), + os.stat(support.TESTFN + "1") ), True ) @@ -298,22 +298,22 @@ # inode information and thus, that samefile() doesn't work if hasattr(os, "symlink"): if hasattr(os, "symlink"): - os.symlink(test_support.TESTFN + "1", test_support.TESTFN + "2") + os.symlink(support.TESTFN + "1", support.TESTFN + "2") self.assertIs( posixpath.samestat( - os.stat(test_support.TESTFN + "1"), - os.stat(test_support.TESTFN + "2") + os.stat(support.TESTFN + "1"), + os.stat(support.TESTFN + "2") ), True ) - os.remove(test_support.TESTFN + "2") - f = open(test_support.TESTFN + "2", "wb") + os.remove(support.TESTFN + "2") + f = open(support.TESTFN + "2", "wb") f.write(b"bar") f.close() self.assertIs( posixpath.samestat( - os.stat(test_support.TESTFN + "1"), - os.stat(test_support.TESTFN + "2") + os.stat(support.TESTFN + "1"), + os.stat(support.TESTFN + "2") ), False ) @@ -399,7 +399,7 @@ os.symlink(ABSTFN+"1", ABSTFN) self.assertEqual(realpath(ABSTFN), ABSTFN+"1") finally: - test_support.unlink(ABSTFN) + support.unlink(ABSTFN) def test_realpath_symlink_loops(self): # Bug #930024, return the path unchanged if we get into an infinite @@ -419,9 +419,9 @@ self.assertEqual(realpath(basename(ABSTFN)), ABSTFN) finally: os.chdir(old_path) - test_support.unlink(ABSTFN) - test_support.unlink(ABSTFN+"1") - test_support.unlink(ABSTFN+"2") + support.unlink(ABSTFN) + support.unlink(ABSTFN+"1") + support.unlink(ABSTFN+"2") def test_realpath_resolve_parents(self): # We also need to resolve any symlinks in the parents of a relative @@ -438,7 +438,7 @@ self.assertEqual(realpath("a"), ABSTFN + "/y/a") finally: os.chdir(old_path) - test_support.unlink(ABSTFN + "/k") + support.unlink(ABSTFN + "/k") safe_rmdir(ABSTFN + "/y") safe_rmdir(ABSTFN) @@ -464,7 +464,7 @@ self.assertEqual(realpath(basename(ABSTFN) + "/link-y/.."), ABSTFN + "/k") finally: os.chdir(old_path) - test_support.unlink(ABSTFN + "/link-y") + support.unlink(ABSTFN + "/link-y") safe_rmdir(ABSTFN + "/k/y") safe_rmdir(ABSTFN + "/k") safe_rmdir(ABSTFN) @@ -485,7 +485,7 @@ self.assertEqual(realpath(base + "link/k"), ABSTFN + "/k") finally: os.chdir(old_path) - test_support.unlink(ABSTFN + "link") + support.unlink(ABSTFN + "link") safe_rmdir(ABSTFN + "/k") safe_rmdir(ABSTFN) @@ -506,7 +506,7 @@ os.getcwd = real_getcwd def test_main(): - test_support.run_unittest(PosixPathTest) + support.run_unittest(PosixPathTest) if __name__=="__main__": test_main() Index: Lib/test/test_popen.py =================================================================== --- Lib/test/test_popen.py (revision 62293) +++ Lib/test/test_popen.py (working copy) @@ -5,7 +5,7 @@ """ import unittest -from test import test_support +from test import support import os, sys # Test that command-lines get down as we expect. @@ -40,10 +40,10 @@ 'foo "a \\"quoted\\" arg" bar', ["foo", 'a "quoted" arg', "bar"] ) - test_support.reap_children() + support.reap_children() def test_main(): - test_support.run_unittest(PopenTest) + support.run_unittest(PopenTest) if __name__ == "__main__": test_main() Index: Lib/test/test_urllib2net.py =================================================================== --- Lib/test/test_urllib2net.py (revision 62293) +++ Lib/test/test_urllib2net.py (working copy) @@ -1,7 +1,7 @@ #!/usr/bin/env python import unittest -from test import test_support +from test import support from test.test_urllib2 import sanepathname2url import socket @@ -105,7 +105,7 @@ self._test_urls(urls, self._extra_handlers()) def test_file(self): - TESTFN = test_support.TESTFN + TESTFN = support.TESTFN f = open(TESTFN, 'w') try: f.write('hi there\n') @@ -169,7 +169,7 @@ (expected_err, url, req, type(err), err)) self.assert_(isinstance(err, expected_err), msg) else: - with test_support.transient_internet(): + with support.transient_internet(): buf = f.read() f.close() debug("read %d bytes" % len(buf)) @@ -233,8 +233,8 @@ def test_main(): - test_support.requires("network") - test_support.run_unittest(AuthTests, + support.requires("network") + support.run_unittest(AuthTests, OtherNetworkTests, CloseSocketTest, TimeoutTest, Index: Lib/test/test_ast.py =================================================================== --- Lib/test/test_ast.py (revision 62293) +++ Lib/test/test_ast.py (working copy) @@ -1,5 +1,5 @@ import sys, unittest -from test import test_support +from test import support import _ast def to_tuple(t): @@ -176,7 +176,7 @@ self.assertEquals(to_tuple(ast2), to_tuple(ast)) def test_main(): - test_support.run_unittest(AST_Tests) + support.run_unittest(AST_Tests) def main(): if __name__ != '__main__': Index: Lib/test/test_format.py =================================================================== --- Lib/test/test_format.py (revision 62293) +++ Lib/test/test_format.py (working copy) @@ -1,9 +1,9 @@ -from test.test_support import verbose, TestFailed +from test.support import verbose, TestFailed import sys -import test.test_support as test_support +import test.support as support import unittest -maxsize = test_support.MAX_Py_ssize_t +maxsize = support.MAX_Py_ssize_t # test string formatting operator (I am not sure if this is being tested # elsewhere but, surely, some of the given cases are *not* tested because @@ -256,7 +256,7 @@ raise TestFailed('"%*d"%(maxsize, -127) should fail') def test_main(): - test_support.run_unittest(FormatTest) + support.run_unittest(FormatTest) if __name__ == "__main__":