mirror of
https://github.com/python/cpython.git
synced 2025-08-22 17:55:18 +00:00
#2621 rename test.test_support to test.support
This commit is contained in:
parent
6a654814ea
commit
ee8712cda4
358 changed files with 1308 additions and 1307 deletions
|
@ -179,14 +179,14 @@ at the top-level directory where Python was built. On Windows, executing
|
||||||
tests.
|
tests.
|
||||||
|
|
||||||
|
|
||||||
:mod:`test.test_support` --- Utility functions for tests
|
:mod:`test.support` --- Utility functions for tests
|
||||||
========================================================
|
========================================================
|
||||||
|
|
||||||
.. module:: test.test_support
|
.. module:: test.support
|
||||||
:synopsis: Support for Python regression tests.
|
:synopsis: Support for Python regression tests.
|
||||||
|
|
||||||
|
|
||||||
The :mod:`test.test_support` module provides support for Python's regression
|
The :mod:`test.support` module provides support for Python's regression
|
||||||
tests.
|
tests.
|
||||||
|
|
||||||
This module defines the following exceptions:
|
This module defines the following exceptions:
|
||||||
|
@ -236,7 +236,7 @@ The :mod:`test.test_support` module defines the following constants:
|
||||||
Set to the path that a temporary file may be created at. Any temporary that is
|
Set to the path that a temporary file may be created at. Any temporary that is
|
||||||
created should be closed and unlinked (removed).
|
created should be closed and unlinked (removed).
|
||||||
|
|
||||||
The :mod:`test.test_support` module defines the following functions:
|
The :mod:`test.support` module defines the following functions:
|
||||||
|
|
||||||
|
|
||||||
.. function:: forget(module_name)
|
.. function:: forget(module_name)
|
||||||
|
@ -311,7 +311,7 @@ The :mod:`test.test_support` module defines the following functions:
|
||||||
assert s.getvalue() == "hello"
|
assert s.getvalue() == "hello"
|
||||||
|
|
||||||
|
|
||||||
The :mod:`test.test_support` module defines the following classes:
|
The :mod:`test.support` module defines the following classes:
|
||||||
|
|
||||||
.. class:: TransientResource(exc[, **kwargs])
|
.. class:: TransientResource(exc[, **kwargs])
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ except ImportError:
|
||||||
try:
|
try:
|
||||||
from bsddb3 import test_support
|
from bsddb3 import test_support
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from test import test_support
|
from test import support as test_support
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
|
@ -23,7 +23,7 @@ from bsddb.test.test_all import verbose
|
||||||
try:
|
try:
|
||||||
from bsddb3 import test_support
|
from bsddb3 import test_support
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from test import test_support
|
from test import support as test_support
|
||||||
|
|
||||||
DASH = b'-'
|
DASH = b'-'
|
||||||
letters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
letters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
||||||
|
|
|
@ -19,7 +19,7 @@ except ImportError:
|
||||||
try:
|
try:
|
||||||
from bsddb3 import test_support
|
from bsddb3 import test_support
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from test import test_support
|
from test import support as test_support
|
||||||
|
|
||||||
lexical_cmp = cmp
|
lexical_cmp = cmp
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ from bsddb import db
|
||||||
try:
|
try:
|
||||||
from bsddb3 import test_support
|
from bsddb3 import test_support
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from test import test_support
|
from test import support as test_support
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
|
@ -14,7 +14,7 @@ except ImportError:
|
||||||
try:
|
try:
|
||||||
from bsddb3 import test_support
|
from bsddb3 import test_support
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from test import test_support
|
from test import support as test_support
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
|
@ -12,7 +12,7 @@ from bsddb import db, dbshelve
|
||||||
try:
|
try:
|
||||||
from bsddb3 import test_support
|
from bsddb3 import test_support
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from test import test_support
|
from test import support as test_support
|
||||||
|
|
||||||
from bsddb.test.test_all import verbose
|
from bsddb.test.test_all import verbose
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ except ImportError:
|
||||||
try:
|
try:
|
||||||
from bsddb3 import test_support
|
from bsddb3 import test_support
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from test import test_support
|
from test import support as test_support
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
|
@ -18,7 +18,7 @@ except ImportError:
|
||||||
try:
|
try:
|
||||||
from bsddb3 import test_support
|
from bsddb3 import test_support
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from test import test_support
|
from test import support as test_support
|
||||||
|
|
||||||
from bsddb.test.test_all import verbose
|
from bsddb.test.test_all import verbose
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ from bsddb import db, dbshelve, StringKeys
|
||||||
try:
|
try:
|
||||||
from bsddb3 import test_support
|
from bsddb3 import test_support
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from test import test_support
|
from test import support as test_support
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ except ImportError:
|
||||||
try:
|
try:
|
||||||
from bsddb3 import test_support
|
from bsddb3 import test_support
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from test import test_support
|
from test import support as test_support
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
|
@ -17,7 +17,7 @@ except ImportError:
|
||||||
try:
|
try:
|
||||||
from bsddb3 import test_support
|
from bsddb3 import test_support
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from test import test_support
|
from test import support as test_support
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ except ImportError as e:
|
||||||
try:
|
try:
|
||||||
from bsddb3 import test_support
|
from bsddb3 import test_support
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from test import test_support
|
from test import support as test_support
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
|
@ -21,7 +21,7 @@ except ImportError:
|
||||||
try:
|
try:
|
||||||
from bsddb3 import test_support
|
from bsddb3 import test_support
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from test import test_support
|
from test import support as test_support
|
||||||
|
|
||||||
letters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
letters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ from bsddb.test.test_all import verbose
|
||||||
try:
|
try:
|
||||||
from bsddb3 import test_support
|
from bsddb3 import test_support
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from test import test_support
|
from test import support as test_support
|
||||||
|
|
||||||
|
|
||||||
class DBSequenceTest(unittest.TestCase):
|
class DBSequenceTest(unittest.TestCase):
|
||||||
|
|
|
@ -36,7 +36,7 @@ except ImportError:
|
||||||
try:
|
try:
|
||||||
from bsddb3 import test_support
|
from bsddb3 import test_support
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from test import test_support
|
from test import support as test_support
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
|
@ -5,7 +5,7 @@ import distutils.core
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
import test.test_support
|
import test.support
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
|
||||||
|
@ -39,13 +39,13 @@ class CoreTestCase(unittest.TestCase):
|
||||||
self.cleanup_testfn()
|
self.cleanup_testfn()
|
||||||
|
|
||||||
def cleanup_testfn(self):
|
def cleanup_testfn(self):
|
||||||
path = test.test_support.TESTFN
|
path = test.support.TESTFN
|
||||||
if os.path.isfile(path):
|
if os.path.isfile(path):
|
||||||
os.remove(path)
|
os.remove(path)
|
||||||
elif os.path.isdir(path):
|
elif os.path.isdir(path):
|
||||||
shutil.rmtree(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)
|
open(path, "w").write(text)
|
||||||
return path
|
return path
|
||||||
|
|
||||||
|
@ -63,8 +63,8 @@ class CoreTestCase(unittest.TestCase):
|
||||||
cwd = os.getcwd()
|
cwd = os.getcwd()
|
||||||
|
|
||||||
# Create a directory and write the setup.py file there:
|
# Create a directory and write the setup.py file there:
|
||||||
os.mkdir(test.test_support.TESTFN)
|
os.mkdir(test.support.TESTFN)
|
||||||
setup_py = os.path.join(test.test_support.TESTFN, "setup.py")
|
setup_py = os.path.join(test.support.TESTFN, "setup.py")
|
||||||
distutils.core.run_setup(
|
distutils.core.run_setup(
|
||||||
self.write_setup(setup_prints_cwd, path=setup_py))
|
self.write_setup(setup_prints_cwd, path=setup_py))
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ import io
|
||||||
import sys
|
import sys
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from test.test_support import TESTFN
|
from test.support import TESTFN
|
||||||
|
|
||||||
|
|
||||||
class test_dist(distutils.cmd.Command):
|
class test_dist(distutils.cmd.Command):
|
||||||
|
|
|
@ -4,7 +4,7 @@ from distutils import sysconfig
|
||||||
import os
|
import os
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from test.test_support import TESTFN
|
from test.support import TESTFN
|
||||||
|
|
||||||
class SysconfigTestCase(unittest.TestCase):
|
class SysconfigTestCase(unittest.TestCase):
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ from email import iterators
|
||||||
from email import base64mime
|
from email import base64mime
|
||||||
from email import quoprimime
|
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
|
from email.test import __file__ as landmark
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
# email package unit tests for (optional) Asian codecs
|
# email package unit tests for (optional) Asian codecs
|
||||||
|
|
||||||
import unittest
|
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.test.test_email import TestEmailBase
|
||||||
from email.Charset import Charset
|
from email.Charset import Charset
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
# email package unit tests for (optional) Asian codecs
|
# email package unit tests for (optional) Asian codecs
|
||||||
|
|
||||||
import unittest
|
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.test.test_email import TestEmailBase
|
||||||
from email.charset import Charset
|
from email.charset import Charset
|
||||||
|
|
|
@ -13,7 +13,7 @@ from io import StringIO
|
||||||
from types import ListType
|
from types import ListType
|
||||||
|
|
||||||
from email.test.test_email import TestEmailBase
|
from email.test.test_email import TestEmailBase
|
||||||
from test.test_support import TestSkipped
|
from test.support import TestSkipped
|
||||||
|
|
||||||
import email
|
import email
|
||||||
from email import __file__ as testfile
|
from email import __file__ as testfile
|
||||||
|
@ -128,7 +128,7 @@ def suite():
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
for testclass in _testclasses():
|
for testclass in _testclasses():
|
||||||
test_support.run_unittest(testclass)
|
support.run_unittest(testclass)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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
|
# 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
|
# precision depending on whether Python was loading a module for the first
|
||||||
|
|
|
@ -5,7 +5,7 @@ Tests common to list and UserList.UserList
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from test import test_support, seq_tests
|
from test import support, seq_tests
|
||||||
|
|
||||||
def CmpToKey(mycmp):
|
def CmpToKey(mycmp):
|
||||||
'Convert a cmp= function into a key= function'
|
'Convert a cmp= function into a key= function'
|
||||||
|
@ -66,14 +66,14 @@ class CommonTest(seq_tests.CommonTest):
|
||||||
d.append(d)
|
d.append(d)
|
||||||
d.append(400)
|
d.append(400)
|
||||||
try:
|
try:
|
||||||
fo = open(test_support.TESTFN, "w")
|
fo = open(support.TESTFN, "w")
|
||||||
fo.write(str(d))
|
fo.write(str(d))
|
||||||
fo.close()
|
fo.close()
|
||||||
fo = open(test_support.TESTFN, "r")
|
fo = open(support.TESTFN, "r")
|
||||||
self.assertEqual(fo.read(), repr(d))
|
self.assertEqual(fo.read(), repr(d))
|
||||||
finally:
|
finally:
|
||||||
fo.close()
|
fo.close()
|
||||||
os.remove(test_support.TESTFN)
|
os.remove(support.TESTFN)
|
||||||
|
|
||||||
def test_set_subscript(self):
|
def test_set_subscript(self):
|
||||||
a = self.type2test(range(20))
|
a = self.type2test(range(20))
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
from test import test_support
|
from test import support
|
||||||
|
|
||||||
#
|
#
|
||||||
# One test case for outstanding bugs at the moment:
|
# One test case for outstanding bugs at the moment:
|
||||||
|
@ -22,7 +22,7 @@ class TextIOWrapperTest(unittest.TestCase):
|
||||||
self.normalized = b"AAA\nBBB\nCCC\nDDD\nEEE\n".decode("ASCII")
|
self.normalized = b"AAA\nBBB\nCCC\nDDD\nEEE\n".decode("ASCII")
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
test_support.unlink(test_support.TESTFN)
|
support.unlink(support.TESTFN)
|
||||||
|
|
||||||
|
|
||||||
def test_issue1395_1(self):
|
def test_issue1395_1(self):
|
||||||
|
@ -81,7 +81,7 @@ class TextIOWrapperTest(unittest.TestCase):
|
||||||
|
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
test_support.run_unittest(
|
support.run_unittest(
|
||||||
TextIOWrapperTest)
|
TextIOWrapperTest)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
@ -3,7 +3,7 @@ import pickle
|
||||||
import pickletools
|
import pickletools
|
||||||
import copyreg
|
import copyreg
|
||||||
|
|
||||||
from test.test_support import TestFailed, TESTFN, run_with_locale
|
from test.support import TestFailed, TESTFN, run_with_locale
|
||||||
|
|
||||||
from pickle import bytes_types
|
from pickle import bytes_types
|
||||||
|
|
||||||
|
|
|
@ -171,7 +171,7 @@ if sys.platform == 'darwin':
|
||||||
newsoft = min(hard, max(soft, 1024*2048))
|
newsoft = min(hard, max(soft, 1024*2048))
|
||||||
resource.setrlimit(resource.RLIMIT_STACK, (newsoft, hard))
|
resource.setrlimit(resource.RLIMIT_STACK, (newsoft, hard))
|
||||||
|
|
||||||
from test import test_support
|
from test import support
|
||||||
|
|
||||||
RESOURCE_NAMES = ('audio', 'curses', 'largefile', 'network', 'bsddb',
|
RESOURCE_NAMES = ('audio', 'curses', 'largefile', 'network', 'bsddb',
|
||||||
'decimal', 'compiler', 'subprocess', 'urlfetch')
|
'decimal', 'compiler', 'subprocess', 'urlfetch')
|
||||||
|
@ -209,7 +209,7 @@ def main(tests=None, testdir=None, verbose=0, quiet=False, generate=False,
|
||||||
values that would normally be set by flags on the command line.
|
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:
|
try:
|
||||||
opts, args = getopt.getopt(sys.argv[1:], 'hvgqxsSrf:lu:t:TD:NLR:wM:n',
|
opts, args = getopt.getopt(sys.argv[1:], 'hvgqxsSrf:lu:t:TD:NLR:wM:n',
|
||||||
['help', 'verbose', 'quiet', 'exclude',
|
['help', 'verbose', 'quiet', 'exclude',
|
||||||
|
@ -284,7 +284,7 @@ def main(tests=None, testdir=None, verbose=0, quiet=False, generate=False,
|
||||||
# stringobject.c filling slowly with random data
|
# stringobject.c filling slowly with random data
|
||||||
warm_char_cache()
|
warm_char_cache()
|
||||||
elif o in ('-M', '--memlimit'):
|
elif o in ('-M', '--memlimit'):
|
||||||
test_support.set_memlimit(a)
|
support.set_memlimit(a)
|
||||||
elif o in ('-u', '--use'):
|
elif o in ('-u', '--use'):
|
||||||
u = [x.lower() for x in a.split(',')]
|
u = [x.lower() for x in a.split(',')]
|
||||||
for r in u:
|
for r in u:
|
||||||
|
@ -390,8 +390,8 @@ def main(tests=None, testdir=None, verbose=0, quiet=False, generate=False,
|
||||||
tracer = trace.Trace(ignoredirs=[sys.prefix, sys.exec_prefix],
|
tracer = trace.Trace(ignoredirs=[sys.prefix, sys.exec_prefix],
|
||||||
trace=False, count=True)
|
trace=False, count=True)
|
||||||
test_times = []
|
test_times = []
|
||||||
test_support.verbose = verbose # Tell tests to be moderately quiet
|
support.verbose = verbose # Tell tests to be moderately quiet
|
||||||
test_support.use_resources = use_resources
|
support.use_resources = use_resources
|
||||||
save_modules = sys.modules.keys()
|
save_modules = sys.modules.keys()
|
||||||
for test in tests:
|
for test in tests:
|
||||||
if not quiet:
|
if not quiet:
|
||||||
|
@ -433,7 +433,7 @@ def main(tests=None, testdir=None, verbose=0, quiet=False, generate=False,
|
||||||
# Unload the newly imported modules (best effort finalization)
|
# Unload the newly imported modules (best effort finalization)
|
||||||
for module in sys.modules.keys():
|
for module in sys.modules.keys():
|
||||||
if module not in save_modules and module.startswith("test."):
|
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
|
# The lists won't be sorted if running with -r
|
||||||
good.sort()
|
good.sort()
|
||||||
|
@ -479,7 +479,7 @@ def main(tests=None, testdir=None, verbose=0, quiet=False, generate=False,
|
||||||
print("Re-running test %r in verbose mode" % test)
|
print("Re-running test %r in verbose mode" % test)
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
try:
|
try:
|
||||||
test_support.verbose = True
|
support.verbose = True
|
||||||
ok = runtest(test, generate, True, quiet, test_times, testdir,
|
ok = runtest(test, generate, True, quiet, test_times, testdir,
|
||||||
huntrleaks, debug)
|
huntrleaks, debug)
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
|
@ -526,7 +526,6 @@ STDTESTS = [
|
||||||
]
|
]
|
||||||
|
|
||||||
NOTTESTS = {
|
NOTTESTS = {
|
||||||
'test_support',
|
|
||||||
'test_future1',
|
'test_future1',
|
||||||
'test_future2',
|
'test_future2',
|
||||||
}
|
}
|
||||||
|
@ -572,7 +571,7 @@ def runtest(test, generate, verbose, quiet, test_times,
|
||||||
|
|
||||||
def runtest_inner(test, generate, verbose, quiet, test_times,
|
def runtest_inner(test, generate, verbose, quiet, test_times,
|
||||||
testdir=None, huntrleaks=False, debug=False):
|
testdir=None, huntrleaks=False, debug=False):
|
||||||
test_support.unload(test)
|
support.unload(test)
|
||||||
if not testdir:
|
if not testdir:
|
||||||
testdir = findtestdir()
|
testdir = findtestdir()
|
||||||
if verbose:
|
if verbose:
|
||||||
|
@ -606,19 +605,19 @@ def runtest_inner(test, generate, verbose, quiet, test_times,
|
||||||
test_times.append((test_time, test))
|
test_times.append((test_time, test))
|
||||||
finally:
|
finally:
|
||||||
sys.stdout = save_stdout
|
sys.stdout = save_stdout
|
||||||
except test_support.ResourceDenied as msg:
|
except support.ResourceDenied as msg:
|
||||||
if not quiet:
|
if not quiet:
|
||||||
print(test, "skipped --", msg)
|
print(test, "skipped --", msg)
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
return -2
|
return -2
|
||||||
except (ImportError, test_support.TestSkipped) as msg:
|
except (ImportError, support.TestSkipped) as msg:
|
||||||
if not quiet:
|
if not quiet:
|
||||||
print(test, "skipped --", msg)
|
print(test, "skipped --", msg)
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
return -1
|
return -1
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
raise
|
raise
|
||||||
except test_support.TestFailed as msg:
|
except support.TestFailed as msg:
|
||||||
print("test", test, "failed --", msg)
|
print("test", test, "failed --", msg)
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
return 0
|
return 0
|
||||||
|
@ -652,7 +651,7 @@ def cleanup_test_droppings(testname, verbose):
|
||||||
# since if a test leaves a file open, it cannot be deleted by name (while
|
# 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
|
# there's nothing we can do about that here either, we can display the
|
||||||
# name of the offending test, which is a real help).
|
# name of the offending test, which is a real help).
|
||||||
for name in (test_support.TESTFN,
|
for name in (support.TESTFN,
|
||||||
"db_home",
|
"db_home",
|
||||||
):
|
):
|
||||||
if not os.path.exists(name):
|
if not os.path.exists(name):
|
||||||
|
@ -1206,10 +1205,10 @@ class _ExpectedSkips:
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
# Remove regrtest.py's own directory from the module search path. This
|
# Remove regrtest.py's own directory from the module search path. This
|
||||||
# prevents relative imports from working, and relative imports will screw
|
# prevents relative imports from working, and relative imports will screw
|
||||||
# up the testing framework. E.g. if both test.test_support and
|
# up the testing framework. E.g. if both test.support and
|
||||||
# test_support are imported, they will not contain the same globals, and
|
# support are imported, they will not contain the same globals, and
|
||||||
# much of the testing framework relies on the globals in the
|
# 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])))
|
mydir = os.path.abspath(os.path.normpath(os.path.dirname(sys.argv[0])))
|
||||||
i = pathlen = len(sys.path)
|
i = pathlen = len(sys.path)
|
||||||
while i >= 0:
|
while i >= 0:
|
||||||
|
|
|
@ -3,7 +3,7 @@ Common tests shared by test_str, test_unicode, test_userstring and test_string.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import unittest, string, sys, struct
|
import unittest, string, sys, struct
|
||||||
from test import test_support
|
from test import support
|
||||||
from collections import UserList
|
from collections import UserList
|
||||||
|
|
||||||
class Sequence:
|
class Sequence:
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
"""Supporting definitions for the Python regression tests."""
|
"""Supporting definitions for the Python regression tests."""
|
||||||
|
|
||||||
if __name__ != 'test.test_support':
|
if __name__ != 'test.support':
|
||||||
raise ImportError('test_support must be imported from the test package')
|
raise ImportError('support must be imported from the test package')
|
||||||
|
|
||||||
import contextlib
|
import contextlib
|
||||||
import errno
|
import errno
|
||||||
|
@ -700,7 +700,7 @@ def run_doctest(module, verbosity=None):
|
||||||
"""Run doctest on the given module. Return (#failures, #tests).
|
"""Run doctest on the given module. Return (#failures, #tests).
|
||||||
|
|
||||||
If optional argument verbosity is not specified (or is None), pass
|
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).
|
usual behavior is used (it searches sys.argv for -v).
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -5,7 +5,7 @@ We don't want to require the 'network' resource.
|
||||||
|
|
||||||
import os, unittest
|
import os, unittest
|
||||||
from SimpleHTTPServer import SimpleHTTPRequestHandler
|
from SimpleHTTPServer import SimpleHTTPRequestHandler
|
||||||
from test import test_support
|
from test import support
|
||||||
|
|
||||||
|
|
||||||
class SocketlessRequestHandler (SimpleHTTPRequestHandler):
|
class SocketlessRequestHandler (SimpleHTTPRequestHandler):
|
||||||
|
@ -35,7 +35,7 @@ class SimpleHTTPRequestHandlerTestCase(unittest.TestCase):
|
||||||
|
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
test_support.run_unittest(SimpleHTTPRequestHandlerTestCase)
|
support.run_unittest(SimpleHTTPRequestHandlerTestCase)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
test_main()
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import unittest
|
import unittest
|
||||||
from test.test_support import run_unittest, catch_warning
|
from test.support import run_unittest, catch_warning
|
||||||
import sys
|
import sys
|
||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#! /usr/bin/env python
|
#! /usr/bin/env python
|
||||||
import unittest
|
import unittest
|
||||||
from test import test_support
|
from test import support
|
||||||
import __future__
|
import __future__
|
||||||
|
|
||||||
GOOD_SERIALS = ("alpha", "beta", "candidate", "final")
|
GOOD_SERIALS = ("alpha", "beta", "candidate", "final")
|
||||||
|
@ -57,7 +57,7 @@ class FutureTest(unittest.TestCase):
|
||||||
".compiler_flag isn't int")
|
".compiler_flag isn't int")
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
test_support.run_unittest(FutureTest)
|
support.run_unittest(FutureTest)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
test_main()
|
||||||
|
|
|
@ -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,
|
from _locale import (setlocale, LC_ALL, LC_CTYPE, LC_NUMERIC, RADIXCHAR, THOUSEP, nl_langinfo,
|
||||||
localeconv, Error)
|
localeconv, Error)
|
||||||
import unittest
|
import unittest
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
"""Unit tests for abc.py."""
|
"""Unit tests for abc.py."""
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
from test import test_support
|
from test import support
|
||||||
|
|
||||||
import abc
|
import abc
|
||||||
from inspect import isabstract
|
from inspect import isabstract
|
||||||
|
@ -170,7 +170,7 @@ class TestABC(unittest.TestCase):
|
||||||
|
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
test_support.run_unittest(TestABC)
|
support.run_unittest(TestABC)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
@ -5,7 +5,7 @@ import operator
|
||||||
import unittest
|
import unittest
|
||||||
from numbers import Complex, Real, Rational, Integral
|
from numbers import Complex, Real, Rational, Integral
|
||||||
from numbers import Number
|
from numbers import Number
|
||||||
from test import test_support
|
from test import support
|
||||||
|
|
||||||
class TestNumbers(unittest.TestCase):
|
class TestNumbers(unittest.TestCase):
|
||||||
def test_int(self):
|
def test_int(self):
|
||||||
|
@ -40,7 +40,7 @@ class TestNumbers(unittest.TestCase):
|
||||||
self.assertRaises(TypeError, int, c1)
|
self.assertRaises(TypeError, int, c1)
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
test_support.run_unittest(TestNumbers)
|
support.run_unittest(TestNumbers)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
@ -7,9 +7,9 @@ import os
|
||||||
import unittest
|
import unittest
|
||||||
import anydbm
|
import anydbm
|
||||||
import glob
|
import glob
|
||||||
from test import test_support
|
from test import support
|
||||||
|
|
||||||
_fname = test_support.TESTFN
|
_fname = support.TESTFN
|
||||||
|
|
||||||
_all_modules = []
|
_all_modules = []
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ class AnyDBMTestCase(unittest.TestCase):
|
||||||
def test_main():
|
def test_main():
|
||||||
try:
|
try:
|
||||||
for module in dbm_iterator():
|
for module in dbm_iterator():
|
||||||
test_support.run_unittest(AnyDBMTestCase)
|
support.run_unittest(AnyDBMTestCase)
|
||||||
finally:
|
finally:
|
||||||
delete_files()
|
delete_files()
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
from test import test_support
|
from test import support
|
||||||
from weakref import proxy
|
from weakref import proxy
|
||||||
import array, io, math
|
import array, io, math
|
||||||
from pickle import loads, dumps
|
from pickle import loads, dumps
|
||||||
|
@ -162,13 +162,13 @@ class BaseTest(unittest.TestCase):
|
||||||
def test_tofromfile(self):
|
def test_tofromfile(self):
|
||||||
a = array.array(self.typecode, 2*self.example)
|
a = array.array(self.typecode, 2*self.example)
|
||||||
self.assertRaises(TypeError, a.tofile)
|
self.assertRaises(TypeError, a.tofile)
|
||||||
test_support.unlink(test_support.TESTFN)
|
support.unlink(support.TESTFN)
|
||||||
f = open(test_support.TESTFN, 'wb')
|
f = open(support.TESTFN, 'wb')
|
||||||
try:
|
try:
|
||||||
a.tofile(f)
|
a.tofile(f)
|
||||||
f.close()
|
f.close()
|
||||||
b = array.array(self.typecode)
|
b = array.array(self.typecode)
|
||||||
f = open(test_support.TESTFN, 'rb')
|
f = open(support.TESTFN, 'rb')
|
||||||
self.assertRaises(TypeError, b.fromfile)
|
self.assertRaises(TypeError, b.fromfile)
|
||||||
b.fromfile(f, len(self.example))
|
b.fromfile(f, len(self.example))
|
||||||
self.assertEqual(b, array.array(self.typecode, self.example))
|
self.assertEqual(b, array.array(self.typecode, self.example))
|
||||||
|
@ -180,7 +180,7 @@ class BaseTest(unittest.TestCase):
|
||||||
finally:
|
finally:
|
||||||
if not f.closed:
|
if not f.closed:
|
||||||
f.close()
|
f.close()
|
||||||
test_support.unlink(test_support.TESTFN)
|
support.unlink(support.TESTFN)
|
||||||
|
|
||||||
def test_tofromlist(self):
|
def test_tofromlist(self):
|
||||||
a = array.array(self.typecode, 2*self.example)
|
a = array.array(self.typecode, 2*self.example)
|
||||||
|
@ -967,14 +967,14 @@ tests.append(DoubleTest)
|
||||||
def test_main(verbose=None):
|
def test_main(verbose=None):
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
test_support.run_unittest(*tests)
|
support.run_unittest(*tests)
|
||||||
|
|
||||||
# verify reference counting
|
# verify reference counting
|
||||||
if verbose and hasattr(sys, "gettotalrefcount"):
|
if verbose and hasattr(sys, "gettotalrefcount"):
|
||||||
import gc
|
import gc
|
||||||
counts = [None] * 5
|
counts = [None] * 5
|
||||||
for i in range(len(counts)):
|
for i in range(len(counts)):
|
||||||
test_support.run_unittest(*tests)
|
support.run_unittest(*tests)
|
||||||
gc.collect()
|
gc.collect()
|
||||||
counts[i] = sys.gettotalrefcount()
|
counts[i] = sys.gettotalrefcount()
|
||||||
print(counts)
|
print(counts)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import sys, unittest
|
import sys, unittest
|
||||||
from test import test_support
|
from test import support
|
||||||
import _ast
|
import _ast
|
||||||
|
|
||||||
def to_tuple(t):
|
def to_tuple(t):
|
||||||
|
@ -176,7 +176,7 @@ class AST_Tests(unittest.TestCase):
|
||||||
self.assertEquals(to_tuple(ast2), to_tuple(ast))
|
self.assertEquals(to_tuple(ast2), to_tuple(ast))
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
test_support.run_unittest(AST_Tests)
|
support.run_unittest(AST_Tests)
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
if __name__ != '__main__':
|
if __name__ != '__main__':
|
||||||
|
|
|
@ -4,9 +4,9 @@ import thread # If this fails, we can't test this module
|
||||||
import asyncore, asynchat, socket, threading, time
|
import asyncore, asynchat, socket, threading, time
|
||||||
import unittest
|
import unittest
|
||||||
import sys
|
import sys
|
||||||
from test import test_support
|
from test import support
|
||||||
|
|
||||||
HOST = test_support.HOST
|
HOST = support.HOST
|
||||||
SERVER_QUIT = b'QUIT\n'
|
SERVER_QUIT = b'QUIT\n'
|
||||||
|
|
||||||
class echo_server(threading.Thread):
|
class echo_server(threading.Thread):
|
||||||
|
@ -18,7 +18,7 @@ class echo_server(threading.Thread):
|
||||||
threading.Thread.__init__(self)
|
threading.Thread.__init__(self)
|
||||||
self.event = event
|
self.event = event
|
||||||
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
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):
|
def run(self):
|
||||||
self.sock.listen(1)
|
self.sock.listen(1)
|
||||||
|
@ -248,7 +248,7 @@ class TestFifo(unittest.TestCase):
|
||||||
|
|
||||||
|
|
||||||
def test_main(verbose=None):
|
def test_main(verbose=None):
|
||||||
test_support.run_unittest(TestAsynchat, TestAsynchat_WithPoll,
|
support.run_unittest(TestAsynchat, TestAsynchat_WithPoll,
|
||||||
TestHelperFunctions, TestFifo)
|
TestHelperFunctions, TestFifo)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
@ -7,12 +7,12 @@ import threading
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from test import test_support
|
from test import support
|
||||||
from test.test_support import TESTFN, run_unittest, unlink
|
from test.support import TESTFN, run_unittest, unlink
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from io import StringIO
|
from io import StringIO
|
||||||
|
|
||||||
HOST = test_support.HOST
|
HOST = support.HOST
|
||||||
|
|
||||||
class dummysocket:
|
class dummysocket:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -334,7 +334,7 @@ class DispatcherWithSendTests(unittest.TestCase):
|
||||||
self.evt = threading.Event()
|
self.evt = threading.Event()
|
||||||
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||||
self.sock.settimeout(3)
|
self.sock.settimeout(3)
|
||||||
self.port = test_support.bind_port(self.sock)
|
self.port = support.bind_port(self.sock)
|
||||||
|
|
||||||
cap = BytesIO()
|
cap = BytesIO()
|
||||||
args = (self.evt, cap, self.sock)
|
args = (self.evt, cap, self.sock)
|
||||||
|
|
|
@ -2,7 +2,7 @@ import sys
|
||||||
import unittest
|
import unittest
|
||||||
import io
|
import io
|
||||||
import atexit
|
import atexit
|
||||||
from test import test_support
|
from test import support
|
||||||
|
|
||||||
### helpers
|
### helpers
|
||||||
def h1():
|
def h1():
|
||||||
|
@ -109,7 +109,7 @@ class TestCase(unittest.TestCase):
|
||||||
|
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
test_support.run_unittest(TestCase)
|
support.run_unittest(TestCase)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
test_main()
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Test audioop.
|
# Test audioop.
|
||||||
import audioop
|
import audioop
|
||||||
from test.test_support import verbose
|
from test.support import verbose
|
||||||
|
|
||||||
def gendata1():
|
def gendata1():
|
||||||
return b'\0\1\2'
|
return b'\0\1\2'
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Augmented assignment test.
|
# Augmented assignment test.
|
||||||
|
|
||||||
from test.test_support import run_unittest
|
from test.support import run_unittest
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import unittest
|
import unittest
|
||||||
from test import test_support
|
from test import support
|
||||||
import base64
|
import base64
|
||||||
import binascii
|
import binascii
|
||||||
|
|
||||||
|
@ -209,7 +209,7 @@ class BaseXYTestCase(unittest.TestCase):
|
||||||
|
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
test_support.run_unittest(__name__)
|
support.run_unittest(__name__)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
test_main()
|
test_main()
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
from test import test_support
|
from test import support
|
||||||
from test.test_support import bigaddrspacetest, MAX_Py_ssize_t
|
from test.support import bigaddrspacetest, MAX_Py_ssize_t
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
import operator
|
import operator
|
||||||
|
@ -38,9 +38,9 @@ class StrTest(unittest.TestCase):
|
||||||
|
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
test_support.run_unittest(StrTest)
|
support.run_unittest(StrTest)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
if len(sys.argv) > 1:
|
if len(sys.argv) > 1:
|
||||||
test_support.set_memlimit(sys.argv[1])
|
support.set_memlimit(sys.argv[1])
|
||||||
test_main()
|
test_main()
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
from test import test_support
|
from test import support
|
||||||
from test.test_support import bigmemtest, _1G, _2G
|
from test.support import bigmemtest, _1G, _2G
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
import operator
|
import operator
|
||||||
|
@ -957,9 +957,9 @@ class ListTest(unittest.TestCase):
|
||||||
self.assertEquals(l[-10:], [5] * 10)
|
self.assertEquals(l[-10:], [5] * 10)
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
test_support.run_unittest(StrTest, TupleTest, ListTest)
|
support.run_unittest(StrTest, TupleTest, ListTest)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
if len(sys.argv) > 1:
|
if len(sys.argv) > 1:
|
||||||
test_support.set_memlimit(sys.argv[1])
|
support.set_memlimit(sys.argv[1])
|
||||||
test_main()
|
test_main()
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
"""Test the binascii C module."""
|
"""Test the binascii C module."""
|
||||||
|
|
||||||
from test import test_support
|
from test import support
|
||||||
import unittest
|
import unittest
|
||||||
import binascii
|
import binascii
|
||||||
|
|
||||||
|
@ -169,7 +169,7 @@ class BinASCIITest(unittest.TestCase):
|
||||||
binascii.crc_hqx('', 0)
|
binascii.crc_hqx('', 0)
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
test_support.run_unittest(BinASCIITest)
|
support.run_unittest(BinASCIITest)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
test_main()
|
||||||
|
|
|
@ -7,18 +7,18 @@
|
||||||
import binhex
|
import binhex
|
||||||
import os
|
import os
|
||||||
import unittest
|
import unittest
|
||||||
from test import test_support
|
from test import support
|
||||||
|
|
||||||
|
|
||||||
class BinHexTestCase(unittest.TestCase):
|
class BinHexTestCase(unittest.TestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.fname1 = test_support.TESTFN + "1"
|
self.fname1 = support.TESTFN + "1"
|
||||||
self.fname2 = test_support.TESTFN + "2"
|
self.fname2 = support.TESTFN + "2"
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
test_support.unlink(self.fname1)
|
support.unlink(self.fname1)
|
||||||
test_support.unlink(self.fname2)
|
support.unlink(self.fname2)
|
||||||
|
|
||||||
DATA = b'Jack is my hero'
|
DATA = b'Jack is my hero'
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ class BinHexTestCase(unittest.TestCase):
|
||||||
|
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
test_support.run_unittest(BinHexTestCase)
|
support.run_unittest(BinHexTestCase)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
"""Tests for binary operators on subtypes of built-in types."""
|
"""Tests for binary operators on subtypes of built-in types."""
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
from test import test_support
|
from test import support
|
||||||
|
|
||||||
def gcd(a, b):
|
def gcd(a, b):
|
||||||
"""Greatest common divisor using Euclid's algorithm."""
|
"""Greatest common divisor using Euclid's algorithm."""
|
||||||
|
@ -317,7 +317,7 @@ self.assertEqual(eval('1/2'), 0.5)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
test_support.run_unittest(RatTestCase)
|
support.run_unittest(RatTestCase)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import sys
|
import sys
|
||||||
import unittest
|
import unittest
|
||||||
from test import test_support
|
from test import support
|
||||||
from collections import UserList
|
from collections import UserList
|
||||||
|
|
||||||
# We do a bit of trickery here to be able to test both the C implementation
|
# We do a bit of trickery here to be able to test both the C implementation
|
||||||
|
@ -286,15 +286,15 @@ def test_main(verbose=None):
|
||||||
TestInsortPython, TestInsortC,
|
TestInsortPython, TestInsortC,
|
||||||
TestErrorHandlingPython, TestErrorHandlingC]
|
TestErrorHandlingPython, TestErrorHandlingC]
|
||||||
|
|
||||||
test_support.run_unittest(*test_classes)
|
support.run_unittest(*test_classes)
|
||||||
test_support.run_doctest(test_bisect, verbose)
|
support.run_doctest(test_bisect, verbose)
|
||||||
|
|
||||||
# verify reference counting
|
# verify reference counting
|
||||||
if verbose and hasattr(sys, "gettotalrefcount"):
|
if verbose and hasattr(sys, "gettotalrefcount"):
|
||||||
import gc
|
import gc
|
||||||
counts = [None] * 5
|
counts = [None] * 5
|
||||||
for i in range(len(counts)):
|
for i in range(len(counts)):
|
||||||
test_support.run_unittest(*test_classes)
|
support.run_unittest(*test_classes)
|
||||||
gc.collect()
|
gc.collect()
|
||||||
counts[i] = sys.gettotalrefcount()
|
counts[i] = sys.gettotalrefcount()
|
||||||
print(counts)
|
print(counts)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Test properties of bool promised by PEP 285
|
# Test properties of bool promised by PEP 285
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
from test import test_support
|
from test import support
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
@ -26,14 +26,14 @@ class BoolTest(unittest.TestCase):
|
||||||
|
|
||||||
def test_print(self):
|
def test_print(self):
|
||||||
try:
|
try:
|
||||||
fo = open(test_support.TESTFN, "w")
|
fo = open(support.TESTFN, "w")
|
||||||
print(False, True, file=fo)
|
print(False, True, file=fo)
|
||||||
fo.close()
|
fo.close()
|
||||||
fo = open(test_support.TESTFN, "r")
|
fo = open(support.TESTFN, "r")
|
||||||
self.assertEqual(fo.read(), 'False True\n')
|
self.assertEqual(fo.read(), 'False True\n')
|
||||||
finally:
|
finally:
|
||||||
fo.close()
|
fo.close()
|
||||||
os.remove(test_support.TESTFN)
|
os.remove(support.TESTFN)
|
||||||
|
|
||||||
def test_repr(self):
|
def test_repr(self):
|
||||||
self.assertEqual(repr(False), 'False')
|
self.assertEqual(repr(False), 'False')
|
||||||
|
@ -234,12 +234,12 @@ class BoolTest(unittest.TestCase):
|
||||||
|
|
||||||
def test_fileclosed(self):
|
def test_fileclosed(self):
|
||||||
try:
|
try:
|
||||||
f = open(test_support.TESTFN, "w")
|
f = open(support.TESTFN, "w")
|
||||||
self.assertIs(f.closed, False)
|
self.assertIs(f.closed, False)
|
||||||
f.close()
|
f.close()
|
||||||
self.assertIs(f.closed, True)
|
self.assertIs(f.closed, True)
|
||||||
finally:
|
finally:
|
||||||
os.remove(test_support.TESTFN)
|
os.remove(support.TESTFN)
|
||||||
|
|
||||||
def test_operator(self):
|
def test_operator(self):
|
||||||
import operator
|
import operator
|
||||||
|
@ -331,7 +331,7 @@ class BoolTest(unittest.TestCase):
|
||||||
self.assertEqual(str(e_bool), str(e_len))
|
self.assertEqual(str(e_bool), str(e_len))
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
test_support.run_unittest(BoolTest)
|
support.run_unittest(BoolTest)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
test_main()
|
||||||
|
|
|
@ -7,7 +7,7 @@ import copy
|
||||||
import bsddb
|
import bsddb
|
||||||
import dbhash # Just so we know it's imported
|
import dbhash # Just so we know it's imported
|
||||||
import unittest
|
import unittest
|
||||||
from test import test_support
|
from test import support
|
||||||
|
|
||||||
class TestBSDDB(unittest.TestCase):
|
class TestBSDDB(unittest.TestCase):
|
||||||
openflag = 'c'
|
openflag = 'c'
|
||||||
|
@ -274,7 +274,7 @@ class TestBSDDB(unittest.TestCase):
|
||||||
self.assertEqual(list(self.f), keys)
|
self.assertEqual(list(self.f), keys)
|
||||||
|
|
||||||
class TestBTree(TestBSDDB):
|
class TestBTree(TestBSDDB):
|
||||||
fname = test_support.TESTFN
|
fname = support.TESTFN
|
||||||
openmethod = [bsddb.btopen]
|
openmethod = [bsddb.btopen]
|
||||||
|
|
||||||
class TestBTree_InMemory(TestBSDDB):
|
class TestBTree_InMemory(TestBSDDB):
|
||||||
|
@ -287,7 +287,7 @@ class TestBTree_InMemory_Truncate(TestBSDDB):
|
||||||
openmethod = [bsddb.btopen]
|
openmethod = [bsddb.btopen]
|
||||||
|
|
||||||
class TestHashTable(TestBSDDB):
|
class TestHashTable(TestBSDDB):
|
||||||
fname = test_support.TESTFN
|
fname = support.TESTFN
|
||||||
openmethod = [bsddb.hashopen]
|
openmethod = [bsddb.hashopen]
|
||||||
|
|
||||||
class TestHashTable_InMemory(TestBSDDB):
|
class TestHashTable_InMemory(TestBSDDB):
|
||||||
|
@ -299,7 +299,7 @@ class TestHashTable_InMemory(TestBSDDB):
|
||||||
## # Solaris Intel - rmasse 1/97
|
## # Solaris Intel - rmasse 1/97
|
||||||
|
|
||||||
def test_main(verbose=None):
|
def test_main(verbose=None):
|
||||||
test_support.run_unittest(
|
support.run_unittest(
|
||||||
TestBTree,
|
TestBTree,
|
||||||
TestHashTable,
|
TestHashTable,
|
||||||
TestBTree_InMemory,
|
TestBTree_InMemory,
|
||||||
|
|
|
@ -7,7 +7,7 @@ import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
import time
|
import time
|
||||||
import unittest
|
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
|
# When running as a script instead of within the regrtest framework, skip the
|
||||||
# requires test, since it's obvious we want to run them.
|
# requires test, since it's obvious we want to run them.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import unittest
|
import unittest
|
||||||
from test import test_support
|
from test import support
|
||||||
|
|
||||||
# Simple test to ensure that optimizations in fileobject.c deliver
|
# Simple test to ensure that optimizations in fileobject.c deliver
|
||||||
# the expected results. For best testing, run this under a debug-build
|
# the expected results. For best testing, run this under a debug-build
|
||||||
|
@ -14,18 +14,18 @@ class BufferSizeTest(unittest.TestCase):
|
||||||
# .readline()s deliver what we wrote.
|
# .readline()s deliver what we wrote.
|
||||||
|
|
||||||
# Ensure we can open TESTFN for writing.
|
# 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
|
# Since C doesn't guarantee we can write/read arbitrary bytes in text
|
||||||
# files, use binary mode.
|
# files, use binary mode.
|
||||||
f = open(test_support.TESTFN, "wb")
|
f = open(support.TESTFN, "wb")
|
||||||
try:
|
try:
|
||||||
# write once with \n and once without
|
# write once with \n and once without
|
||||||
f.write(s)
|
f.write(s)
|
||||||
f.write(b"\n")
|
f.write(b"\n")
|
||||||
f.write(s)
|
f.write(s)
|
||||||
f.close()
|
f.close()
|
||||||
f = open(test_support.TESTFN, "rb")
|
f = open(support.TESTFN, "rb")
|
||||||
line = f.readline()
|
line = f.readline()
|
||||||
self.assertEqual(line, s + b"\n")
|
self.assertEqual(line, s + b"\n")
|
||||||
line = f.readline()
|
line = f.readline()
|
||||||
|
@ -34,7 +34,7 @@ class BufferSizeTest(unittest.TestCase):
|
||||||
self.assert_(not line) # Must be at EOF
|
self.assert_(not line) # Must be at EOF
|
||||||
f.close()
|
f.close()
|
||||||
finally:
|
finally:
|
||||||
test_support.unlink(test_support.TESTFN)
|
support.unlink(support.TESTFN)
|
||||||
|
|
||||||
def drive_one(self, pattern):
|
def drive_one(self, pattern):
|
||||||
for length in lengths:
|
for length in lengths:
|
||||||
|
@ -59,7 +59,7 @@ class BufferSizeTest(unittest.TestCase):
|
||||||
self.drive_one(bytes(1000))
|
self.drive_one(bytes(1000))
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
test_support.run_unittest(BufferSizeTest)
|
support.run_unittest(BufferSizeTest)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
test_main()
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Python test set -- built-in functions
|
# Python test set -- built-in functions
|
||||||
|
|
||||||
import test.test_support, unittest
|
import test.support, unittest
|
||||||
from test.test_support import fcmp, TESTFN, unlink, run_unittest, \
|
from test.support import fcmp, TESTFN, unlink, run_unittest, \
|
||||||
run_with_locale
|
run_with_locale
|
||||||
from operator import neg
|
from operator import neg
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ import pickle
|
||||||
import tempfile
|
import tempfile
|
||||||
import unittest
|
import unittest
|
||||||
import warnings
|
import warnings
|
||||||
import test.test_support
|
import test.support
|
||||||
import test.string_tests
|
import test.string_tests
|
||||||
import test.buffer_tests
|
import test.buffer_tests
|
||||||
|
|
||||||
|
@ -969,13 +969,13 @@ class ByteArraySubclassTest(unittest.TestCase):
|
||||||
|
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
test.test_support.run_unittest(BytesTest)
|
test.support.run_unittest(BytesTest)
|
||||||
test.test_support.run_unittest(ByteArrayTest)
|
test.support.run_unittest(ByteArrayTest)
|
||||||
test.test_support.run_unittest(AssortedBytesTest)
|
test.support.run_unittest(AssortedBytesTest)
|
||||||
test.test_support.run_unittest(BytesAsStringTest)
|
test.support.run_unittest(BytesAsStringTest)
|
||||||
test.test_support.run_unittest(ByteArrayAsStringTest)
|
test.support.run_unittest(ByteArrayAsStringTest)
|
||||||
test.test_support.run_unittest(ByteArraySubclassTest)
|
test.support.run_unittest(ByteArraySubclassTest)
|
||||||
test.test_support.run_unittest(BytearrayPEP3137Test)
|
test.support.run_unittest(BytearrayPEP3137Test)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
test_main()
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
from test import test_support
|
from test import support
|
||||||
from test.test_support import TESTFN
|
from test.support import TESTFN
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
|
@ -333,13 +333,13 @@ class FuncTest(BaseTest):
|
||||||
self.assertRaises(ValueError, bz2.decompress, self.DATA[:-10])
|
self.assertRaises(ValueError, bz2.decompress, self.DATA[:-10])
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
test_support.run_unittest(
|
support.run_unittest(
|
||||||
BZ2FileTest,
|
BZ2FileTest,
|
||||||
BZ2CompressorTest,
|
BZ2CompressorTest,
|
||||||
BZ2DecompressorTest,
|
BZ2DecompressorTest,
|
||||||
FuncTest
|
FuncTest
|
||||||
)
|
)
|
||||||
test_support.reap_children()
|
support.reap_children()
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
test_main()
|
test_main()
|
||||||
|
|
|
@ -121,7 +121,7 @@ class C:
|
||||||
|
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
from test.test_support import TestSkipped
|
from test.support import TestSkipped
|
||||||
raise TestSkipped('test_cProfile test is current broken')
|
raise TestSkipped('test_cProfile test is current broken')
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import calendar
|
import calendar
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from test import test_support
|
from test import support
|
||||||
|
|
||||||
|
|
||||||
result_2004_text = """
|
result_2004_text = """
|
||||||
|
@ -383,7 +383,7 @@ class SundayTestCase(MonthCalendarTestCase):
|
||||||
|
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
test_support.run_unittest(
|
support.run_unittest(
|
||||||
OutputTestCase,
|
OutputTestCase,
|
||||||
CalendarTestCase,
|
CalendarTestCase,
|
||||||
MondayTestCase,
|
MondayTestCase,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import unittest
|
import unittest
|
||||||
from test import test_support
|
from test import support
|
||||||
|
|
||||||
# The test cases here cover several paths through the function calling
|
# 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
|
# code. They depend on the METH_XXX flag that is used to define a C
|
||||||
|
@ -124,7 +124,7 @@ class CFunctionCalls(unittest.TestCase):
|
||||||
|
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
test_support.run_unittest(CFunctionCalls)
|
support.run_unittest(CFunctionCalls)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
# these are all functions _testcapi exports whose name begins with 'test_'.
|
# these are all functions _testcapi exports whose name begins with 'test_'.
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
from test import test_support
|
from test import support
|
||||||
import _testcapi
|
import _testcapi
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
|
@ -10,13 +10,13 @@ def test_main():
|
||||||
for name in dir(_testcapi):
|
for name in dir(_testcapi):
|
||||||
if name.startswith('test_'):
|
if name.startswith('test_'):
|
||||||
test = getattr(_testcapi, name)
|
test = getattr(_testcapi, name)
|
||||||
if test_support.verbose:
|
if support.verbose:
|
||||||
print("internal", name)
|
print("internal", name)
|
||||||
test()
|
test()
|
||||||
|
|
||||||
# some extra thread-state tests driven via _testcapi
|
# some extra thread-state tests driven via _testcapi
|
||||||
def TestThreadState():
|
def TestThreadState():
|
||||||
if test_support.verbose:
|
if support.verbose:
|
||||||
print("auto-thread-state")
|
print("auto-thread-state")
|
||||||
|
|
||||||
idents = []
|
idents = []
|
||||||
|
@ -29,7 +29,7 @@ def test_main():
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
# Check our main thread is in the list exactly 3 times.
|
# Check our main thread is in the list exactly 3 times.
|
||||||
if idents.count(thread.get_ident()) != 3:
|
if idents.count(thread.get_ident()) != 3:
|
||||||
raise test_support.TestFailed(
|
raise support.TestFailed(
|
||||||
"Couldn't find main thread correctly in the list")
|
"Couldn't find main thread correctly in the list")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -3,7 +3,7 @@ import io
|
||||||
import unittest
|
import unittest
|
||||||
import collections
|
import collections
|
||||||
|
|
||||||
from test import test_support
|
from test import support
|
||||||
|
|
||||||
class SortedDict(collections.UserDict):
|
class SortedDict(collections.UserDict):
|
||||||
def items(self):
|
def items(self):
|
||||||
|
@ -251,7 +251,7 @@ class TestCaseBase(unittest.TestCase):
|
||||||
cf.set("sect", "option2", "splat")
|
cf.set("sect", "option2", "splat")
|
||||||
|
|
||||||
def test_read_returns_file_list(self):
|
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:
|
# check when we pass a mix of readable and non-readable files:
|
||||||
cf = self.newconfig()
|
cf = self.newconfig()
|
||||||
parsed_files = cf.read([file1, "nonexistant-file"])
|
parsed_files = cf.read([file1, "nonexistant-file"])
|
||||||
|
@ -469,7 +469,7 @@ class SortedTestCase(RawConfigParserTestCase):
|
||||||
"o4 = 1\n\n")
|
"o4 = 1\n\n")
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
test_support.run_unittest(
|
support.run_unittest(
|
||||||
ConfigParserTestCase,
|
ConfigParserTestCase,
|
||||||
RawConfigParserTestCase,
|
RawConfigParserTestCase,
|
||||||
SafeConfigParserTestCase,
|
SafeConfigParserTestCase,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from test.test_support import run_unittest
|
from test.support import run_unittest
|
||||||
import cgi
|
import cgi
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
|
@ -9,7 +9,7 @@ Written by Marc-Andre Lemburg (mal@lemburg.com).
|
||||||
|
|
||||||
"""#"
|
"""#"
|
||||||
|
|
||||||
import test.test_support, unittest
|
import test.support, unittest
|
||||||
|
|
||||||
import codecs
|
import codecs
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ class CharmapCodecTest(unittest.TestCase):
|
||||||
self.assertRaises(UnicodeError, str, b'abc\001', codecname)
|
self.assertRaises(UnicodeError, str, b'abc\001', codecname)
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
test.test_support.run_unittest(CharmapCodecTest)
|
test.support.run_unittest(CharmapCodecTest)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
test_main()
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from test import test_support
|
from test import support
|
||||||
|
|
||||||
testmeths = [
|
testmeths = [
|
||||||
|
|
||||||
|
@ -555,7 +555,7 @@ class ClassTests(unittest.TestCase):
|
||||||
hash(a.f)
|
hash(a.f)
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
test_support.run_unittest(ClassTests)
|
support.run_unittest(ClassTests)
|
||||||
|
|
||||||
if __name__=='__main__':
|
if __name__=='__main__':
|
||||||
test_main()
|
test_main()
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from test.test_support import run_unittest
|
from test.support import run_unittest
|
||||||
from test.test_math import parse_testfile, test_file
|
from test.test_math import parse_testfile, test_file
|
||||||
import unittest
|
import unittest
|
||||||
import os, sys
|
import os, sys
|
||||||
|
|
|
@ -167,8 +167,8 @@ class samplecmdclass(cmd.Cmd):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def test_main(verbose=None):
|
def test_main(verbose=None):
|
||||||
from test import test_support, test_cmd
|
from test import support, test_cmd
|
||||||
test_support.run_doctest(test_cmd, verbose)
|
support.run_doctest(test_cmd, verbose)
|
||||||
|
|
||||||
def test_coverage(coverdir):
|
def test_coverage(coverdir):
|
||||||
tracer=trace.Trace(ignoredirs=[sys.prefix, sys.exec_prefix,],
|
tracer=trace.Trace(ignoredirs=[sys.prefix, sys.exec_prefix,],
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
# All tests are executed with environment variables ignored
|
# All tests are executed with environment variables ignored
|
||||||
# See test_cmd_line_script.py for testing of script execution
|
# See test_cmd_line_script.py for testing of script execution
|
||||||
|
|
||||||
import test.test_support, unittest
|
import test.support, unittest
|
||||||
import sys
|
import sys
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
|
@ -123,8 +123,8 @@ class CmdLineTest(unittest.TestCase):
|
||||||
|
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
test.test_support.run_unittest(CmdLineTest)
|
test.support.run_unittest(CmdLineTest)
|
||||||
test.test_support.reap_children()
|
test.support.reap_children()
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
test_main()
|
||||||
|
|
|
@ -4,7 +4,7 @@ import unittest
|
||||||
import os
|
import os
|
||||||
import os.path
|
import os.path
|
||||||
import sys
|
import sys
|
||||||
import test.test_support
|
import test.support
|
||||||
import tempfile
|
import tempfile
|
||||||
import subprocess
|
import subprocess
|
||||||
import py_compile
|
import py_compile
|
||||||
|
@ -12,9 +12,9 @@ import contextlib
|
||||||
import shutil
|
import shutil
|
||||||
import zipfile
|
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
|
from test.test_cmd_line import _spawn_python, _kill_python
|
||||||
|
|
||||||
def _run_python(*args):
|
def _run_python(*args):
|
||||||
|
@ -176,8 +176,8 @@ class CmdLineTest(unittest.TestCase):
|
||||||
|
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
test.test_support.run_unittest(CmdLineTest)
|
test.support.run_unittest(CmdLineTest)
|
||||||
test.test_support.reap_children()
|
test.support.reap_children()
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
test_main()
|
test_main()
|
||||||
|
|
|
@ -119,7 +119,7 @@ def dump(co):
|
||||||
print("consts:", tuple(consts(co.co_consts)))
|
print("consts:", tuple(consts(co.co_consts)))
|
||||||
|
|
||||||
def test_main(verbose=None):
|
def test_main(verbose=None):
|
||||||
from test.test_support import run_doctest
|
from test.support import run_doctest
|
||||||
from test import test_code
|
from test import test_code
|
||||||
run_doctest(test_code, verbose)
|
run_doctest(test_code, verbose)
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import test.test_support, unittest
|
import test.support, unittest
|
||||||
import sys, codecs, html.entities, unicodedata
|
import sys, codecs, html.entities, unicodedata
|
||||||
|
|
||||||
class PosReturn:
|
class PosReturn:
|
||||||
|
@ -843,7 +843,7 @@ class CodecCallbackTest(unittest.TestCase):
|
||||||
self.assertRaises(TypeError, data.decode, encoding, "test.replacing")
|
self.assertRaises(TypeError, data.decode, encoding, "test.replacing")
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
test.test_support.run_unittest(CodecCallbackTest)
|
test.support.run_unittest(CodecCallbackTest)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
test_main()
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
# Codec encoding tests for PRC encodings.
|
# Codec encoding tests for PRC encodings.
|
||||||
#
|
#
|
||||||
|
|
||||||
from test import test_support
|
from test import support
|
||||||
from test import test_multibytecodec_support
|
from test import test_multibytecodec_support
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ class Test_GB18030(test_multibytecodec_support.TestBase, unittest.TestCase):
|
||||||
has_iso10646 = True
|
has_iso10646 = True
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
test_support.run_unittest(__name__)
|
support.run_unittest(__name__)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
test_main()
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
# Codec encoding tests for HongKong encodings.
|
# Codec encoding tests for HongKong encodings.
|
||||||
#
|
#
|
||||||
|
|
||||||
from test import test_support
|
from test import support
|
||||||
from test import test_multibytecodec_support
|
from test import test_multibytecodec_support
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ class Test_Big5HKSCS(test_multibytecodec_support.TestBase, unittest.TestCase):
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
test_support.run_unittest(__name__)
|
support.run_unittest(__name__)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
test_main()
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
# Codec encoding tests for Japanese encodings.
|
# Codec encoding tests for Japanese encodings.
|
||||||
#
|
#
|
||||||
|
|
||||||
from test import test_support
|
from test import support
|
||||||
from test import test_multibytecodec_support
|
from test import test_multibytecodec_support
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ class Test_SJISX0213(test_multibytecodec_support.TestBase, unittest.TestCase):
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
test_support.run_unittest(__name__)
|
support.run_unittest(__name__)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
test_main()
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
# Codec encoding tests for ROK encodings.
|
# Codec encoding tests for ROK encodings.
|
||||||
#
|
#
|
||||||
|
|
||||||
from test import test_support
|
from test import support
|
||||||
from test import test_multibytecodec_support
|
from test import test_multibytecodec_support
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ class Test_JOHAB(test_multibytecodec_support.TestBase, unittest.TestCase):
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
test_support.run_unittest(__name__)
|
support.run_unittest(__name__)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
test_main()
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
# Codec encoding tests for ROC encodings.
|
# Codec encoding tests for ROC encodings.
|
||||||
#
|
#
|
||||||
|
|
||||||
from test import test_support
|
from test import support
|
||||||
from test import test_multibytecodec_support
|
from test import test_multibytecodec_support
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ class Test_Big5(test_multibytecodec_support.TestBase, unittest.TestCase):
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
test_support.run_unittest(__name__)
|
support.run_unittest(__name__)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
test_main()
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
# Codec mapping tests for PRC encodings
|
# Codec mapping tests for PRC encodings
|
||||||
#
|
#
|
||||||
|
|
||||||
from test import test_support
|
from test import support
|
||||||
from test import test_multibytecodec_support
|
from test import test_multibytecodec_support
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ class TestGB18030Map(test_multibytecodec_support.TestBase_Mapping,
|
||||||
|
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
test_support.run_unittest(__name__)
|
support.run_unittest(__name__)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
test_main()
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
# Codec mapping tests for HongKong encodings
|
# Codec mapping tests for HongKong encodings
|
||||||
#
|
#
|
||||||
|
|
||||||
from test import test_support
|
from test import support
|
||||||
from test import test_multibytecodec_support
|
from test import test_multibytecodec_support
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
@ -14,8 +14,8 @@ class TestBig5HKSCSMap(test_multibytecodec_support.TestBase_Mapping,
|
||||||
mapfileurl = 'http://people.freebsd.org/~perky/i18n/BIG5HKSCS-2004.TXT'
|
mapfileurl = 'http://people.freebsd.org/~perky/i18n/BIG5HKSCS-2004.TXT'
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
test_support.run_unittest(__name__)
|
support.run_unittest(__name__)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_support.use_resources = ['urlfetch']
|
support.use_resources = ['urlfetch']
|
||||||
test_main()
|
test_main()
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
# Codec mapping tests for Japanese encodings
|
# Codec mapping tests for Japanese encodings
|
||||||
#
|
#
|
||||||
|
|
||||||
from test import test_support
|
from test import support
|
||||||
from test import test_multibytecodec_support
|
from test import test_multibytecodec_support
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ class TestSJISX0213Map(test_multibytecodec_support.TestBase_Mapping,
|
||||||
|
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
test_support.run_unittest(__name__)
|
support.run_unittest(__name__)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
test_main()
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
# Codec mapping tests for ROK encodings
|
# Codec mapping tests for ROK encodings
|
||||||
#
|
#
|
||||||
|
|
||||||
from test import test_support
|
from test import support
|
||||||
from test import test_multibytecodec_support
|
from test import test_multibytecodec_support
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ class TestJOHABMap(test_multibytecodec_support.TestBase_Mapping,
|
||||||
pass_dectest = [(b'\\', '\u20a9')]
|
pass_dectest = [(b'\\', '\u20a9')]
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
test_support.run_unittest(__name__)
|
support.run_unittest(__name__)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
test_main()
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
# Codec mapping tests for ROC encodings
|
# Codec mapping tests for ROC encodings
|
||||||
#
|
#
|
||||||
|
|
||||||
from test import test_support
|
from test import support
|
||||||
from test import test_multibytecodec_support
|
from test import test_multibytecodec_support
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ class TestCP950Map(test_multibytecodec_support.TestBase_Mapping,
|
||||||
]
|
]
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
test_support.run_unittest(__name__)
|
support.run_unittest(__name__)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
test_main()
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from test import test_support
|
from test import support
|
||||||
import unittest
|
import unittest
|
||||||
import codecs
|
import codecs
|
||||||
import sys, _testcapi, io
|
import sys, _testcapi, io
|
||||||
|
@ -1032,7 +1032,7 @@ class NameprepTest(unittest.TestCase):
|
||||||
try:
|
try:
|
||||||
self.assertEquals(nameprep(orig), prepped)
|
self.assertEquals(nameprep(orig), prepped)
|
||||||
except Exception as e:
|
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):
|
class IDNACodecTest(unittest.TestCase):
|
||||||
def test_builtin_decode(self):
|
def test_builtin_decode(self):
|
||||||
|
@ -1477,7 +1477,7 @@ class WithStmtTest(unittest.TestCase):
|
||||||
|
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
test_support.run_unittest(
|
support.run_unittest(
|
||||||
UTF32Test,
|
UTF32Test,
|
||||||
UTF32LETest,
|
UTF32LETest,
|
||||||
UTF32BETest,
|
UTF32BETest,
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
Nick Mathewson
|
Nick Mathewson
|
||||||
"""
|
"""
|
||||||
import unittest
|
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
|
from codeop import compile_command, PyCF_DONT_IMPLY_DEDENT
|
||||||
import io
|
import io
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
import test.test_support, unittest
|
import test.support, unittest
|
||||||
from test.test_support import TESTFN, unlink
|
from test.support import TESTFN, unlink
|
||||||
import os, sys
|
import os, sys
|
||||||
|
|
||||||
class CodingTest(unittest.TestCase):
|
class CodingTest(unittest.TestCase):
|
||||||
|
@ -50,7 +50,7 @@ class CodingTest(unittest.TestCase):
|
||||||
sys.path.pop(0)
|
sys.path.pop(0)
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
test.test_support.run_unittest(CodingTest)
|
test.support.run_unittest(CodingTest)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
test_main()
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
"""Unit tests for collections.py."""
|
"""Unit tests for collections.py."""
|
||||||
|
|
||||||
import unittest, doctest
|
import unittest, doctest
|
||||||
from test import test_support
|
from test import support
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
from collections import Hashable, Iterable, Iterator
|
from collections import Hashable, Iterable, Iterator
|
||||||
from collections import Sized, Container, Callable
|
from collections import Sized, Container, Callable
|
||||||
|
@ -321,8 +321,8 @@ import doctest, collections
|
||||||
def test_main(verbose=None):
|
def test_main(verbose=None):
|
||||||
NamedTupleDocs = doctest.DocTestSuite(module=collections)
|
NamedTupleDocs = doctest.DocTestSuite(module=collections)
|
||||||
test_classes = [TestNamedTuple, NamedTupleDocs, TestOneTrickPonyABCs, TestCollectionABCs]
|
test_classes = [TestNamedTuple, NamedTupleDocs, TestOneTrickPonyABCs, TestCollectionABCs]
|
||||||
test_support.run_unittest(*test_classes)
|
support.run_unittest(*test_classes)
|
||||||
test_support.run_doctest(collections, verbose)
|
support.run_doctest(collections, verbose)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import unittest, test.test_support
|
import unittest, test.support
|
||||||
import colorsys
|
import colorsys
|
||||||
|
|
||||||
def frange(start, stop, step):
|
def frange(start, stop, step):
|
||||||
|
@ -70,7 +70,7 @@ class ColorsysTest(unittest.TestCase):
|
||||||
self.assertTripleEqual(rgb, colorsys.hls_to_rgb(*hls))
|
self.assertTripleEqual(rgb, colorsys.hls_to_rgb(*hls))
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
test.test_support.run_unittest(ColorsysTest)
|
test.support.run_unittest(ColorsysTest)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
test_main()
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
import unittest
|
import unittest
|
||||||
import os, tempfile, re
|
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 *
|
from commands import *
|
||||||
|
|
||||||
# The module says:
|
# The module says:
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import unittest
|
import unittest
|
||||||
from test import test_support
|
from test import support
|
||||||
|
|
||||||
class Empty:
|
class Empty:
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
|
@ -61,7 +61,7 @@ class ComparisonTest(unittest.TestCase):
|
||||||
|
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
test_support.run_unittest(ComparisonTest)
|
support.run_unittest(ComparisonTest)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
test_main()
|
test_main()
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import unittest
|
import unittest
|
||||||
import sys
|
import sys
|
||||||
import _ast
|
import _ast
|
||||||
from test import test_support
|
from test import support
|
||||||
|
|
||||||
class TestSpecifics(unittest.TestCase):
|
class TestSpecifics(unittest.TestCase):
|
||||||
|
|
||||||
|
@ -444,7 +444,7 @@ if 1:
|
||||||
|
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
test_support.run_unittest(TestSpecifics)
|
support.run_unittest(TestSpecifics)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
test_main()
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import unittest, os
|
import unittest, os
|
||||||
from test import test_support
|
from test import support
|
||||||
|
|
||||||
from random import random
|
from random import random
|
||||||
from math import atan2
|
from math import atan2
|
||||||
|
@ -339,16 +339,16 @@ class ComplexTest(unittest.TestCase):
|
||||||
|
|
||||||
fo = None
|
fo = None
|
||||||
try:
|
try:
|
||||||
fo = open(test_support.TESTFN, "w")
|
fo = open(support.TESTFN, "w")
|
||||||
print(a, b, file=fo)
|
print(a, b, file=fo)
|
||||||
fo.close()
|
fo.close()
|
||||||
fo = open(test_support.TESTFN, "r")
|
fo = open(support.TESTFN, "r")
|
||||||
self.assertEqual(fo.read(), ("%s %s\n" % (a, b)))
|
self.assertEqual(fo.read(), ("%s %s\n" % (a, b)))
|
||||||
finally:
|
finally:
|
||||||
if (fo is not None) and (not fo.closed):
|
if (fo is not None) and (not fo.closed):
|
||||||
fo.close()
|
fo.close()
|
||||||
try:
|
try:
|
||||||
os.remove(test_support.TESTFN)
|
os.remove(support.TESTFN)
|
||||||
except (OSError, IOError):
|
except (OSError, IOError):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -360,7 +360,7 @@ class ComplexTest(unittest.TestCase):
|
||||||
self.assertEquals(atan2(z2.imag, -1.), atan2(-0., -1.))
|
self.assertEquals(atan2(z2.imag, -1.), atan2(-0., -1.))
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
test_support.run_unittest(ComplexTest)
|
support.run_unittest(ComplexTest)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
test_main()
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from test.test_support import run_unittest
|
from test.support import run_unittest
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ import tempfile
|
||||||
import unittest
|
import unittest
|
||||||
import threading
|
import threading
|
||||||
from contextlib import * # Tests __all__
|
from contextlib import * # Tests __all__
|
||||||
from test import test_support
|
from test import support
|
||||||
|
|
||||||
class ContextManagerTestCase(unittest.TestCase):
|
class ContextManagerTestCase(unittest.TestCase):
|
||||||
|
|
||||||
|
@ -331,7 +331,7 @@ class LockContextTestCase(unittest.TestCase):
|
||||||
|
|
||||||
# This is needed to make the test actually run under regrtest.py!
|
# This is needed to make the test actually run under regrtest.py!
|
||||||
def test_main():
|
def test_main():
|
||||||
test_support.run_unittest(__name__)
|
support.run_unittest(__name__)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
test_main()
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Simple test suite for Cookie.py
|
# 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 unittest
|
||||||
import Cookie
|
import Cookie
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
import re, os, time
|
import re, os, time
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
|
||||||
from test import test_support
|
from test import support
|
||||||
|
|
||||||
class DateTimeTests(TestCase):
|
class DateTimeTests(TestCase):
|
||||||
|
|
||||||
|
@ -234,7 +234,7 @@ class FileCookieJarTests(TestCase):
|
||||||
def test_lwp_valueless_cookie(self):
|
def test_lwp_valueless_cookie(self):
|
||||||
# cookies with no value should be saved and loaded consistently
|
# cookies with no value should be saved and loaded consistently
|
||||||
from cookielib import LWPCookieJar
|
from cookielib import LWPCookieJar
|
||||||
filename = test_support.TESTFN
|
filename = support.TESTFN
|
||||||
c = LWPCookieJar()
|
c = LWPCookieJar()
|
||||||
interact_netscape(c, "http://www.acme.com/", 'boo')
|
interact_netscape(c, "http://www.acme.com/", 'boo')
|
||||||
self.assertEqual(c._cookies["www.acme.com"]["/"]["boo"].value, None)
|
self.assertEqual(c._cookies["www.acme.com"]["/"]["boo"].value, None)
|
||||||
|
@ -250,7 +250,7 @@ class FileCookieJarTests(TestCase):
|
||||||
def test_bad_magic(self):
|
def test_bad_magic(self):
|
||||||
from cookielib import LWPCookieJar, MozillaCookieJar, LoadError
|
from cookielib import LWPCookieJar, MozillaCookieJar, LoadError
|
||||||
# IOErrors (eg. file doesn't exist) are allowed to propagate
|
# IOErrors (eg. file doesn't exist) are allowed to propagate
|
||||||
filename = test_support.TESTFN
|
filename = support.TESTFN
|
||||||
for cookiejar_class in LWPCookieJar, MozillaCookieJar:
|
for cookiejar_class in LWPCookieJar, MozillaCookieJar:
|
||||||
c = cookiejar_class()
|
c = cookiejar_class()
|
||||||
try:
|
try:
|
||||||
|
@ -356,7 +356,7 @@ class CookieTests(TestCase):
|
||||||
|
|
||||||
# missing = sign in Cookie: header is regarded by Mozilla as a missing
|
# missing = sign in Cookie: header is regarded by Mozilla as a missing
|
||||||
# name, and by cookielib as a missing value
|
# name, and by cookielib as a missing value
|
||||||
filename = test_support.TESTFN
|
filename = support.TESTFN
|
||||||
c = MozillaCookieJar(filename)
|
c = MozillaCookieJar(filename)
|
||||||
interact_netscape(c, "http://www.acme.com/", 'eggs')
|
interact_netscape(c, "http://www.acme.com/", 'eggs')
|
||||||
interact_netscape(c, "http://www.acme.com/", '"spam"; path=/foo/')
|
interact_netscape(c, "http://www.acme.com/", '"spam"; path=/foo/')
|
||||||
|
@ -1505,7 +1505,7 @@ class LWPCookieTests(TestCase):
|
||||||
self.assertEquals(len(c), 6)
|
self.assertEquals(len(c), 6)
|
||||||
|
|
||||||
# save and restore
|
# save and restore
|
||||||
filename = test_support.TESTFN
|
filename = support.TESTFN
|
||||||
|
|
||||||
try:
|
try:
|
||||||
c.save(filename, ignore_discard=True)
|
c.save(filename, ignore_discard=True)
|
||||||
|
@ -1547,7 +1547,7 @@ class LWPCookieTests(TestCase):
|
||||||
|
|
||||||
year_plus_one = time.localtime()[0] + 1
|
year_plus_one = time.localtime()[0] + 1
|
||||||
|
|
||||||
filename = test_support.TESTFN
|
filename = support.TESTFN
|
||||||
|
|
||||||
c = MozillaCookieJar(filename,
|
c = MozillaCookieJar(filename,
|
||||||
policy=DefaultCookiePolicy(rfc2965=True))
|
policy=DefaultCookiePolicy(rfc2965=True))
|
||||||
|
@ -1722,7 +1722,7 @@ class LWPCookieTests(TestCase):
|
||||||
|
|
||||||
|
|
||||||
def test_main(verbose=None):
|
def test_main(verbose=None):
|
||||||
test_support.run_unittest(
|
support.run_unittest(
|
||||||
DateTimeTests,
|
DateTimeTests,
|
||||||
HeaderTests,
|
HeaderTests,
|
||||||
CookieTests,
|
CookieTests,
|
||||||
|
|
|
@ -4,7 +4,7 @@ import copy
|
||||||
import copyreg
|
import copyreg
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
from test import test_support
|
from test import support
|
||||||
|
|
||||||
class TestCopy(unittest.TestCase):
|
class TestCopy(unittest.TestCase):
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ class TestCopy(unittest.TestCase):
|
||||||
def __reduce_ex__(self, proto):
|
def __reduce_ex__(self, proto):
|
||||||
return ""
|
return ""
|
||||||
def __reduce__(self):
|
def __reduce__(self):
|
||||||
raise test_support.TestFailed("shouldn't call this")
|
raise support.TestFailed("shouldn't call this")
|
||||||
x = C()
|
x = C()
|
||||||
y = copy.copy(x)
|
y = copy.copy(x)
|
||||||
self.assert_(y is x)
|
self.assert_(y is x)
|
||||||
|
@ -223,7 +223,7 @@ class TestCopy(unittest.TestCase):
|
||||||
def __reduce_ex__(self, proto):
|
def __reduce_ex__(self, proto):
|
||||||
return ""
|
return ""
|
||||||
def __reduce__(self):
|
def __reduce__(self):
|
||||||
raise test_support.TestFailed("shouldn't call this")
|
raise support.TestFailed("shouldn't call this")
|
||||||
x = C()
|
x = C()
|
||||||
y = copy.deepcopy(x)
|
y = copy.deepcopy(x)
|
||||||
self.assert_(y is x)
|
self.assert_(y is x)
|
||||||
|
@ -584,7 +584,7 @@ class TestCopy(unittest.TestCase):
|
||||||
def global_foo(x, y): return x+y
|
def global_foo(x, y): return x+y
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
test_support.run_unittest(TestCopy)
|
support.run_unittest(TestCopy)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
test_main()
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import copyreg
|
import copyreg
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from test import test_support
|
from test import support
|
||||||
from test.pickletester import ExtensionSaver
|
from test.pickletester import ExtensionSaver
|
||||||
|
|
||||||
class C:
|
class C:
|
||||||
|
@ -114,7 +114,7 @@ class CopyRegTestCase(unittest.TestCase):
|
||||||
|
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
test_support.run_unittest(CopyRegTestCase)
|
support.run_unittest(CopyRegTestCase)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from test import test_support
|
from test import support
|
||||||
import unittest
|
import unittest
|
||||||
import crypt
|
import crypt
|
||||||
|
|
||||||
|
@ -6,11 +6,11 @@ class CryptTestCase(unittest.TestCase):
|
||||||
|
|
||||||
def test_crypt(self):
|
def test_crypt(self):
|
||||||
c = crypt.crypt('mypassword', 'ab')
|
c = crypt.crypt('mypassword', 'ab')
|
||||||
if test_support.verbose:
|
if support.verbose:
|
||||||
print('Test encryption: ', c)
|
print('Test encryption: ', c)
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
test_support.run_unittest(CryptTestCase)
|
support.run_unittest(CryptTestCase)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
test_main()
|
||||||
|
|
|
@ -10,7 +10,7 @@ from io import StringIO, BytesIO
|
||||||
from tempfile import TemporaryFile
|
from tempfile import TemporaryFile
|
||||||
import csv
|
import csv
|
||||||
import gc
|
import gc
|
||||||
from test import test_support
|
from test import support
|
||||||
|
|
||||||
class Test_Csv(unittest.TestCase):
|
class Test_Csv(unittest.TestCase):
|
||||||
"""
|
"""
|
||||||
|
@ -790,7 +790,7 @@ Stonecutters Seafood and Chop House, Lemont, IL, 12/19/02, Week Back
|
||||||
self.assertEqual(dialect.quotechar, "'")
|
self.assertEqual(dialect.quotechar, "'")
|
||||||
|
|
||||||
if not hasattr(sys, "gettotalrefcount"):
|
if not hasattr(sys, "gettotalrefcount"):
|
||||||
if test_support.verbose: print("*** skipping leakage tests ***")
|
if support.verbose: print("*** skipping leakage tests ***")
|
||||||
else:
|
else:
|
||||||
class NUL:
|
class NUL:
|
||||||
def write(s, *args):
|
def write(s, *args):
|
||||||
|
@ -891,7 +891,7 @@ class TestUnicode(unittest.TestCase):
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
mod = sys.modules[__name__]
|
mod = sys.modules[__name__]
|
||||||
test_support.run_unittest(
|
support.run_unittest(
|
||||||
*[getattr(mod, name) for name in dir(mod) if name.startswith('Test')]
|
*[getattr(mod, name) for name in dir(mod) if name.startswith('Test')]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from test.test_support import run_unittest
|
from test.support import run_unittest
|
||||||
import ctypes.test
|
import ctypes.test
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue