mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
[3.10] bpo-45229: Remove test_main in many tests (GH-28405) (GH-28455)
Instead of explicitly enumerate test classes for run_unittest()
use the unittest ability to discover tests. This also makes these
tests discoverable and runnable with unittest.
load_tests() can be used for dynamic generating tests and adding
doctests. setUpModule(), tearDownModule() and addModuleCleanup()
can be used for running code before and after all module tests.
(cherry picked from commit 40348acc18)
This commit is contained in:
parent
9c23a1ebad
commit
bedce3538c
61 changed files with 207 additions and 485 deletions
|
|
@ -8,7 +8,7 @@
|
||||||
# regression test, the filterwarnings() call has been added to
|
# regression test, the filterwarnings() call has been added to
|
||||||
# regrtest.py.
|
# regrtest.py.
|
||||||
|
|
||||||
from test.test_support import run_unittest, check_syntax_error
|
from test.test_support import check_syntax_error
|
||||||
import unittest
|
import unittest
|
||||||
import sys
|
import sys
|
||||||
# testing import *
|
# testing import *
|
||||||
|
|
@ -967,8 +967,5 @@ def _checkeval(msg, ret):
|
||||||
self.assertEqual((6 < 4 if 0 else 2), 2)
|
self.assertEqual((6 < 4 if 0 else 2), 2)
|
||||||
|
|
||||||
|
|
||||||
def test_main():
|
|
||||||
run_unittest(TokenTests, GrammarTests)
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
test_main()
|
unittest.main()
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
# regression test, the filterwarnings() call has been added to
|
# regression test, the filterwarnings() call has been added to
|
||||||
# regrtest.py.
|
# regrtest.py.
|
||||||
|
|
||||||
from test.support import run_unittest, check_syntax_error
|
from test.support import check_syntax_error
|
||||||
import unittest
|
import unittest
|
||||||
import sys
|
import sys
|
||||||
# testing import *
|
# testing import *
|
||||||
|
|
@ -952,8 +952,5 @@ def _checkeval(msg, ret):
|
||||||
self.assertEqual((6 < 4 if 0 else 2), 2)
|
self.assertEqual((6 < 4 if 0 else 2), 2)
|
||||||
|
|
||||||
|
|
||||||
def test_main():
|
|
||||||
run_unittest(TokenTests, GrammarTests)
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
test_main()
|
unittest.main()
|
||||||
|
|
|
||||||
|
|
@ -687,9 +687,8 @@ def check_sizeof(test, o, size):
|
||||||
# Decorator for running a function in a different locale, correctly resetting
|
# Decorator for running a function in a different locale, correctly resetting
|
||||||
# it afterwards.
|
# it afterwards.
|
||||||
|
|
||||||
|
@contextlib.contextmanager
|
||||||
def run_with_locale(catstr, *locales):
|
def run_with_locale(catstr, *locales):
|
||||||
def decorator(func):
|
|
||||||
def inner(*args, **kwds):
|
|
||||||
try:
|
try:
|
||||||
import locale
|
import locale
|
||||||
category = getattr(locale, catstr)
|
category = getattr(locale, catstr)
|
||||||
|
|
@ -708,16 +707,11 @@ def inner(*args, **kwds):
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# now run the function, resetting the locale on exceptions
|
|
||||||
try:
|
try:
|
||||||
return func(*args, **kwds)
|
yield
|
||||||
finally:
|
finally:
|
||||||
if locale and orig_locale:
|
if locale and orig_locale:
|
||||||
locale.setlocale(category, orig_locale)
|
locale.setlocale(category, orig_locale)
|
||||||
inner.__name__ = func.__name__
|
|
||||||
inner.__doc__ = func.__doc__
|
|
||||||
return inner
|
|
||||||
return decorator
|
|
||||||
|
|
||||||
#=======================================================================
|
#=======================================================================
|
||||||
# Decorator for running a function in a specific timezone, correctly
|
# Decorator for running a function in a specific timezone, correctly
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@
|
||||||
|
|
||||||
from io import StringIO
|
from io import StringIO
|
||||||
|
|
||||||
from test import support
|
|
||||||
from test.support import os_helper
|
from test.support import os_helper
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
class StdIOBuffer(StringIO):
|
class StdIOBuffer(StringIO):
|
||||||
|
|
@ -5397,13 +5396,11 @@ def test_exit_on_error_with_bad_args(self):
|
||||||
self.parser.parse_args('--integers a'.split())
|
self.parser.parse_args('--integers a'.split())
|
||||||
|
|
||||||
|
|
||||||
def test_main():
|
def tearDownModule():
|
||||||
support.run_unittest(__name__)
|
|
||||||
# Remove global references to avoid looking like we have refleaks.
|
# Remove global references to avoid looking like we have refleaks.
|
||||||
RFile.seen = {}
|
RFile.seen = {}
|
||||||
WFile.seen = set()
|
WFile.seen = set()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
test_main()
|
unittest.main()
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,6 @@
|
||||||
import linecache
|
import linecache
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
from itertools import islice, repeat
|
from itertools import islice, repeat
|
||||||
import test.support
|
|
||||||
from test.support import import_helper
|
from test.support import import_helper
|
||||||
from test.support import os_helper
|
from test.support import os_helper
|
||||||
|
|
||||||
|
|
@ -1193,13 +1192,6 @@ def main():
|
||||||
with TracerRun(self) as tracer:
|
with TracerRun(self) as tracer:
|
||||||
tracer.runcall(tfunc_import)
|
tracer.runcall(tfunc_import)
|
||||||
|
|
||||||
def test_main():
|
|
||||||
test.support.run_unittest(
|
|
||||||
StateTestCase,
|
|
||||||
RunTestCase,
|
|
||||||
BreakpointTestCase,
|
|
||||||
IssuesTestCase,
|
|
||||||
)
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
unittest.main()
|
||||||
|
|
|
||||||
|
|
@ -92,10 +92,7 @@ def test_repeat(self):
|
||||||
x = None
|
x = None
|
||||||
|
|
||||||
|
|
||||||
def test_main():
|
|
||||||
support.run_unittest(BytesTest, StrTest)
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
if len(sys.argv) > 1:
|
if len(sys.argv) > 1:
|
||||||
support.set_memlimit(sys.argv[1])
|
support.set_memlimit(sys.argv[1])
|
||||||
test_main()
|
unittest.main()
|
||||||
|
|
|
||||||
|
|
@ -1247,11 +1247,8 @@ def test_sort(self, size):
|
||||||
self.assertEqual(l[:10], [1] * 10)
|
self.assertEqual(l[:10], [1] * 10)
|
||||||
self.assertEqual(l[-10:], [5] * 10)
|
self.assertEqual(l[-10:], [5] * 10)
|
||||||
|
|
||||||
def test_main():
|
|
||||||
support.run_unittest(StrTest, BytesTest, BytearrayTest,
|
|
||||||
TupleTest, ListTest)
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
if len(sys.argv) > 1:
|
if len(sys.argv) > 1:
|
||||||
support.set_memlimit(sys.argv[1])
|
support.set_memlimit(sys.argv[1])
|
||||||
test_main()
|
unittest.main()
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
# Test properties of bool promised by PEP 285
|
# Test properties of bool promised by PEP 285
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
from test import support
|
|
||||||
from test.support import os_helper
|
from test.support import os_helper
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
@ -370,8 +369,6 @@ def f(x):
|
||||||
f(x)
|
f(x)
|
||||||
self.assertGreaterEqual(x.count, 1)
|
self.assertGreaterEqual(x.count, 1)
|
||||||
|
|
||||||
def test_main():
|
|
||||||
support.run_unittest(BoolTest)
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
unittest.main()
|
||||||
|
|
|
||||||
|
|
@ -1005,15 +1005,9 @@ def test_newline(self):
|
||||||
self.assertEqual(f.readlines(), [text])
|
self.assertEqual(f.readlines(), [text])
|
||||||
|
|
||||||
|
|
||||||
def test_main():
|
def tearDownModule():
|
||||||
support.run_unittest(
|
|
||||||
BZ2FileTest,
|
|
||||||
BZ2CompressorTest,
|
|
||||||
BZ2DecompressorTest,
|
|
||||||
CompressDecompressTest,
|
|
||||||
OpenTest,
|
|
||||||
)
|
|
||||||
support.reap_children()
|
support.reap_children()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
test_main()
|
unittest.main()
|
||||||
|
|
|
||||||
|
|
@ -427,12 +427,9 @@ def test_PYTHONCOERCECLOCALE_set_to_one(self):
|
||||||
self.assertEqual(cmd.stdout.rstrip(), loc)
|
self.assertEqual(cmd.stdout.rstrip(), loc)
|
||||||
|
|
||||||
|
|
||||||
def test_main():
|
def tearDownModule():
|
||||||
support.run_unittest(
|
|
||||||
LocaleConfigurationTests,
|
|
||||||
LocaleCoercionTests
|
|
||||||
)
|
|
||||||
support.reap_children()
|
support.reap_children()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
unittest.main()
|
||||||
|
|
|
||||||
|
|
@ -864,9 +864,10 @@ def test_tokenizer_error_with_stdin(self):
|
||||||
def test_decoding_error_at_the_end_of_the_line(self):
|
def test_decoding_error_at_the_end_of_the_line(self):
|
||||||
self.check_string(br"'\u1f'")
|
self.check_string(br"'\u1f'")
|
||||||
|
|
||||||
def test_main():
|
|
||||||
support.run_unittest(CmdLineTest, IgnoreEnvironmentTest, SyntaxErrorTests)
|
def tearDownModule():
|
||||||
support.reap_children()
|
support.reap_children()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
unittest.main()
|
||||||
|
|
|
||||||
|
|
@ -739,9 +739,9 @@ def test_nonexisting_script(self):
|
||||||
self.assertNotEqual(proc.returncode, 0)
|
self.assertNotEqual(proc.returncode, 0)
|
||||||
|
|
||||||
|
|
||||||
def test_main():
|
def tearDownModule():
|
||||||
support.run_unittest(CmdLineTest)
|
|
||||||
support.reap_children()
|
support.reap_children()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
test_main()
|
unittest.main()
|
||||||
|
|
|
||||||
|
|
@ -777,8 +777,6 @@ def test_format(self):
|
||||||
self.assertEqual(format(complex(INF, 1), 'F'), 'INF+1.000000j')
|
self.assertEqual(format(complex(INF, 1), 'F'), 'INF+1.000000j')
|
||||||
self.assertEqual(format(complex(INF, -1), 'F'), 'INF-1.000000j')
|
self.assertEqual(format(complex(INF, -1), 'F'), 'INF-1.000000j')
|
||||||
|
|
||||||
def test_main():
|
|
||||||
support.run_unittest(ComplexTest)
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
unittest.main()
|
||||||
|
|
|
||||||
|
|
@ -1515,16 +1515,10 @@ def test_multiple_set_exception(self):
|
||||||
self.assertEqual(f.exception(), e)
|
self.assertEqual(f.exception(), e)
|
||||||
|
|
||||||
|
|
||||||
_threads_key = None
|
|
||||||
|
|
||||||
def setUpModule():
|
def setUpModule():
|
||||||
global _threads_key
|
unittest.addModuleCleanup(multiprocessing.util._cleanup_tests)
|
||||||
_threads_key = threading_helper.threading_setup()
|
thread_info = threading_helper.threading_setup()
|
||||||
|
unittest.addModuleCleanup(threading_helper.threading_cleanup, *thread_info)
|
||||||
|
|
||||||
def tearDownModule():
|
|
||||||
threading_helper.threading_cleanup(*_threads_key)
|
|
||||||
multiprocessing.util._cleanup_tests()
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
||||||
|
|
@ -4996,8 +4996,11 @@ def test_repr(self):
|
||||||
self.assertIn('{!r}: {!r}'.format(k, v), r)
|
self.assertIn('{!r}: {!r}'.format(k, v), r)
|
||||||
|
|
||||||
|
|
||||||
class PTypesLongInitTest(unittest.TestCase):
|
class AAAPTypesLongInitTest(unittest.TestCase):
|
||||||
# This is in its own TestCase so that it can be run before any other tests.
|
# This is in its own TestCase so that it can be run before any other tests.
|
||||||
|
# (Hence the 'AAA' in the test class name: to make it the first
|
||||||
|
# item in a list sorted by name, like
|
||||||
|
# unittest.TestLoader.getTestCaseNames() does.)
|
||||||
def test_pytype_long_ready(self):
|
def test_pytype_long_ready(self):
|
||||||
# Testing SF bug 551412 ...
|
# Testing SF bug 551412 ...
|
||||||
|
|
||||||
|
|
@ -5735,12 +5738,5 @@ class A(metaclass=M):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def test_main():
|
|
||||||
# Run all local test cases, with PTypesLongInitTest first.
|
|
||||||
support.run_unittest(PTypesLongInitTest, OperatorsTest,
|
|
||||||
ClassPropertiesAndMethods, DictProxyTests,
|
|
||||||
MiscTests, PicklingTests, SharedKeyTests,
|
|
||||||
MroTest)
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
unittest.main()
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
import random
|
import random
|
||||||
import select
|
import select
|
||||||
import unittest
|
import unittest
|
||||||
from test.support import run_unittest, cpython_only
|
from test.support import cpython_only
|
||||||
|
|
||||||
if not hasattr(select, 'devpoll') :
|
if not hasattr(select, 'devpoll') :
|
||||||
raise unittest.SkipTest('test works only on Solaris OS family')
|
raise unittest.SkipTest('test works only on Solaris OS family')
|
||||||
|
|
@ -138,8 +138,5 @@ def test_events_mask_overflow_c_limits(self):
|
||||||
self.assertRaises(OverflowError, pollster.modify, 1, USHRT_MAX + 1)
|
self.assertRaises(OverflowError, pollster.modify, 1, USHRT_MAX + 1)
|
||||||
|
|
||||||
|
|
||||||
def test_main():
|
|
||||||
run_unittest(DevPollTests)
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
test_main()
|
unittest.main()
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import difflib
|
import difflib
|
||||||
from test.support import run_unittest, findfile
|
from test.support import findfile
|
||||||
import unittest
|
import unittest
|
||||||
import doctest
|
import doctest
|
||||||
import sys
|
import sys
|
||||||
|
|
@ -547,12 +547,14 @@ def test_longest_match_with_popular_chars(self):
|
||||||
self.assertFalse(self.longer_match_exists(a, b, match.size))
|
self.assertFalse(self.longer_match_exists(a, b, match.size))
|
||||||
|
|
||||||
|
|
||||||
def test_main():
|
def setUpModule():
|
||||||
difflib.HtmlDiff._default_prefix = 0
|
difflib.HtmlDiff._default_prefix = 0
|
||||||
Doctests = doctest.DocTestSuite(difflib)
|
|
||||||
run_unittest(
|
|
||||||
TestWithAscii, TestAutojunk, TestSFpatches, TestSFbugs,
|
def load_tests(loader, tests, pattern):
|
||||||
TestOutputFormat, TestBytes, TestJunkAPIs, TestFindLongest, Doctests)
|
tests.addTest(doctest.DocTestSuite(difflib))
|
||||||
|
return tests
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
test_main()
|
unittest.main()
|
||||||
|
|
|
||||||
|
|
@ -15,16 +15,14 @@
|
||||||
import distutils.tests
|
import distutils.tests
|
||||||
|
|
||||||
|
|
||||||
def test_main():
|
|
||||||
# used by regrtest
|
|
||||||
support.run_unittest(distutils.tests.test_suite())
|
|
||||||
support.reap_children()
|
|
||||||
|
|
||||||
|
|
||||||
def load_tests(*_):
|
def load_tests(*_):
|
||||||
# used by unittest
|
# used by unittest
|
||||||
return distutils.tests.test_suite()
|
return distutils.tests.test_suite()
|
||||||
|
|
||||||
|
|
||||||
|
def tearDownModule():
|
||||||
|
support.reap_children()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
unittest.main()
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
import types
|
import types
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from test.support import findfile, run_unittest
|
from test.support import findfile
|
||||||
|
|
||||||
|
|
||||||
def abspath(filename):
|
def abspath(filename):
|
||||||
|
|
@ -97,7 +97,7 @@ class SystemTapBackend(TraceBackend):
|
||||||
COMMAND = ["stap", "-g"]
|
COMMAND = ["stap", "-g"]
|
||||||
|
|
||||||
|
|
||||||
class TraceTests(unittest.TestCase):
|
class TraceTests:
|
||||||
# unittest.TestCase options
|
# unittest.TestCase options
|
||||||
maxDiff = None
|
maxDiff = None
|
||||||
|
|
||||||
|
|
@ -149,30 +149,25 @@ def test_line(self):
|
||||||
self.run_case("line")
|
self.run_case("line")
|
||||||
|
|
||||||
|
|
||||||
class DTraceNormalTests(TraceTests):
|
class DTraceNormalTests(TraceTests, unittest.TestCase):
|
||||||
backend = DTraceBackend()
|
backend = DTraceBackend()
|
||||||
optimize_python = 0
|
optimize_python = 0
|
||||||
|
|
||||||
|
|
||||||
class DTraceOptimizedTests(TraceTests):
|
class DTraceOptimizedTests(TraceTests, unittest.TestCase):
|
||||||
backend = DTraceBackend()
|
backend = DTraceBackend()
|
||||||
optimize_python = 2
|
optimize_python = 2
|
||||||
|
|
||||||
|
|
||||||
class SystemTapNormalTests(TraceTests):
|
class SystemTapNormalTests(TraceTests, unittest.TestCase):
|
||||||
backend = SystemTapBackend()
|
backend = SystemTapBackend()
|
||||||
optimize_python = 0
|
optimize_python = 0
|
||||||
|
|
||||||
|
|
||||||
class SystemTapOptimizedTests(TraceTests):
|
class SystemTapOptimizedTests(TraceTests, unittest.TestCase):
|
||||||
backend = SystemTapBackend()
|
backend = SystemTapBackend()
|
||||||
optimize_python = 2
|
optimize_python = 2
|
||||||
|
|
||||||
|
|
||||||
def test_main():
|
|
||||||
run_unittest(DTraceNormalTests, DTraceOptimizedTests, SystemTapNormalTests,
|
|
||||||
SystemTapOptimizedTests)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
test_main()
|
test_main()
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
import sys
|
import sys
|
||||||
import unittest
|
import unittest
|
||||||
from multiprocessing import Process
|
from multiprocessing import Process
|
||||||
from test.support import (verbose, run_unittest, cpython_only)
|
from test.support import verbose, cpython_only
|
||||||
from test.support.import_helper import import_module
|
from test.support.import_helper import import_module
|
||||||
from test.support.os_helper import TESTFN, unlink
|
from test.support.os_helper import TESTFN, unlink
|
||||||
|
|
||||||
|
|
@ -210,8 +210,5 @@ def test_fcntl_f_pipesize(self):
|
||||||
os.close(test_pipe_w)
|
os.close(test_pipe_w)
|
||||||
|
|
||||||
|
|
||||||
def test_main():
|
|
||||||
run_unittest(TestFcntl)
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
test_main()
|
unittest.main()
|
||||||
|
|
|
||||||
|
|
@ -246,8 +246,5 @@ def _assert_report(self, dircmp_report, expected_report_lines):
|
||||||
self.assertEqual(report_lines, expected_report_lines)
|
self.assertEqual(report_lines, expected_report_lines)
|
||||||
|
|
||||||
|
|
||||||
def test_main():
|
|
||||||
support.run_unittest(FileCompareTestCase, DirCompareTestCase)
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
unittest.main()
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
from weakref import proxy
|
from weakref import proxy
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
|
|
||||||
from test.support import run_unittest, cpython_only, swap_attr, gc_collect
|
from test.support import cpython_only, swap_attr, gc_collect
|
||||||
from test.support.os_helper import (TESTFN, TESTFN_UNICODE, make_bad_fd)
|
from test.support.os_helper import (TESTFN, TESTFN_UNICODE, make_bad_fd)
|
||||||
from test.support.warnings_helper import check_warnings
|
from test.support.warnings_helper import check_warnings
|
||||||
from collections import UserList
|
from collections import UserList
|
||||||
|
|
@ -606,15 +606,12 @@ def test_open_code(self):
|
||||||
self.assertNotEqual(w.warnings, [])
|
self.assertNotEqual(w.warnings, [])
|
||||||
|
|
||||||
|
|
||||||
def test_main():
|
def tearDownModule():
|
||||||
# Historically, these tests have been sloppy about removing TESTFN.
|
# Historically, these tests have been sloppy about removing TESTFN.
|
||||||
# So get rid of it no matter what.
|
# So get rid of it no matter what.
|
||||||
try:
|
if os.path.exists(TESTFN):
|
||||||
run_unittest(CAutoFileTests, PyAutoFileTests,
|
os.unlink(TESTFN)
|
||||||
COtherFileTests, PyOtherFileTests)
|
|
||||||
finally:
|
|
||||||
if os.path.exists(TESTFN):
|
|
||||||
os.unlink(TESTFN)
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
test_main()
|
unittest.main()
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@
|
||||||
import os
|
import os
|
||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
|
import unittest
|
||||||
try:
|
try:
|
||||||
import ssl
|
import ssl
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
|
@ -1144,18 +1145,10 @@ def test__all__(self):
|
||||||
support.check__all__(self, ftplib, not_exported=not_exported)
|
support.check__all__(self, ftplib, not_exported=not_exported)
|
||||||
|
|
||||||
|
|
||||||
def test_main():
|
def setUpModule():
|
||||||
tests = [TestFTPClass, TestTimeouts,
|
|
||||||
TestIPv6Environment,
|
|
||||||
TestTLS_FTPClassMixin, TestTLS_FTPClass,
|
|
||||||
MiscTestCase]
|
|
||||||
|
|
||||||
thread_info = threading_helper.threading_setup()
|
thread_info = threading_helper.threading_setup()
|
||||||
try:
|
unittest.addModuleCleanup(threading_helper.threading_cleanup, *thread_info)
|
||||||
support.run_unittest(*tests)
|
|
||||||
finally:
|
|
||||||
threading_helper.threading_cleanup(*thread_info)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
test_main()
|
unittest.main()
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import unittest
|
import unittest
|
||||||
import unittest.mock
|
import unittest.mock
|
||||||
from test.support import (verbose, refcount_test, run_unittest,
|
from test.support import (verbose, refcount_test,
|
||||||
cpython_only)
|
cpython_only)
|
||||||
from test.support.import_helper import import_module
|
from test.support.import_helper import import_module
|
||||||
from test.support.os_helper import temp_dir, TESTFN, unlink
|
from test.support.os_helper import temp_dir, TESTFN, unlink
|
||||||
|
|
@ -1389,30 +1389,27 @@ def search_func(encoding):
|
||||||
assert_python_ok("-c", code)
|
assert_python_ok("-c", code)
|
||||||
|
|
||||||
|
|
||||||
def test_main():
|
def setUpModule():
|
||||||
|
global enabled, debug
|
||||||
enabled = gc.isenabled()
|
enabled = gc.isenabled()
|
||||||
gc.disable()
|
gc.disable()
|
||||||
assert not gc.isenabled()
|
assert not gc.isenabled()
|
||||||
debug = gc.get_debug()
|
debug = gc.get_debug()
|
||||||
gc.set_debug(debug & ~gc.DEBUG_LEAK) # this test is supposed to leak
|
gc.set_debug(debug & ~gc.DEBUG_LEAK) # this test is supposed to leak
|
||||||
|
gc.collect() # Delete 2nd generation garbage
|
||||||
|
|
||||||
|
|
||||||
|
def tearDownModule():
|
||||||
|
gc.set_debug(debug)
|
||||||
|
# test gc.enable() even if GC is disabled by default
|
||||||
|
if verbose:
|
||||||
|
print("restoring automatic collection")
|
||||||
|
# make sure to always test gc.enable()
|
||||||
|
gc.enable()
|
||||||
|
assert gc.isenabled()
|
||||||
|
if not enabled:
|
||||||
|
gc.disable()
|
||||||
|
|
||||||
try:
|
|
||||||
gc.collect() # Delete 2nd generation garbage
|
|
||||||
run_unittest(
|
|
||||||
GCTests,
|
|
||||||
GCCallbackTests,
|
|
||||||
GCTogglingTests,
|
|
||||||
PythonFinalizationTests)
|
|
||||||
finally:
|
|
||||||
gc.set_debug(debug)
|
|
||||||
# test gc.enable() even if GC is disabled by default
|
|
||||||
if verbose:
|
|
||||||
print("restoring automatic collection")
|
|
||||||
# make sure to always test gc.enable()
|
|
||||||
gc.enable()
|
|
||||||
assert gc.isenabled()
|
|
||||||
if not enabled:
|
|
||||||
gc.disable()
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
unittest.main()
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
"""Verify that warnings are issued for global statements following use."""
|
"""Verify that warnings are issued for global statements following use."""
|
||||||
|
|
||||||
from test.support import run_unittest, check_syntax_error
|
from test.support import check_syntax_error
|
||||||
from test.support.warnings_helper import check_warnings
|
from test.support.warnings_helper import check_warnings
|
||||||
import unittest
|
import unittest
|
||||||
import warnings
|
import warnings
|
||||||
|
|
@ -53,10 +53,12 @@ def test4(self):
|
||||||
compile(prog_text_4, "<test string>", "exec")
|
compile(prog_text_4, "<test string>", "exec")
|
||||||
|
|
||||||
|
|
||||||
def test_main():
|
def setUpModule():
|
||||||
with warnings.catch_warnings():
|
cm = warnings.catch_warnings()
|
||||||
warnings.filterwarnings("error", module="<test string>")
|
cm.__enter__()
|
||||||
run_unittest(GlobalTests)
|
unittest.addModuleCleanup(cm.__exit__, None, None, None)
|
||||||
|
warnings.filterwarnings("error", module="<test string>")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
unittest.main()
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@
|
||||||
import sys
|
import sys
|
||||||
import unittest
|
import unittest
|
||||||
from subprocess import PIPE, Popen
|
from subprocess import PIPE, Popen
|
||||||
from test import support
|
|
||||||
from test.support import import_helper
|
from test.support import import_helper
|
||||||
from test.support import os_helper
|
from test.support import os_helper
|
||||||
from test.support import _4G, bigmemtest
|
from test.support import _4G, bigmemtest
|
||||||
|
|
@ -842,9 +841,5 @@ def test_decompress_cannot_have_flags_compression(self):
|
||||||
self.assertEqual(out, b'')
|
self.assertEqual(out, b'')
|
||||||
|
|
||||||
|
|
||||||
def test_main(verbose=None):
|
|
||||||
support.run_unittest(TestGzip, TestOpen, TestCommandLine)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main(verbose=True)
|
unittest.main()
|
||||||
|
|
|
||||||
|
|
@ -1302,21 +1302,9 @@ def test_server_test_ipv4(self, _):
|
||||||
self.assertEqual(mock_server.address_family, socket.AF_INET)
|
self.assertEqual(mock_server.address_family, socket.AF_INET)
|
||||||
|
|
||||||
|
|
||||||
def test_main(verbose=None):
|
def setUpModule():
|
||||||
cwd = os.getcwd()
|
unittest.addModuleCleanup(os.chdir, os.getcwd())
|
||||||
try:
|
|
||||||
support.run_unittest(
|
|
||||||
RequestHandlerLoggingTestCase,
|
|
||||||
BaseHTTPRequestHandlerTestCase,
|
|
||||||
BaseHTTPServerTestCase,
|
|
||||||
SimpleHTTPServerTestCase,
|
|
||||||
CGIHTTPServerTestCase,
|
|
||||||
SimpleHTTPRequestHandlerTestCase,
|
|
||||||
MiscTestCase,
|
|
||||||
ScriptTestCase
|
|
||||||
)
|
|
||||||
finally:
|
|
||||||
os.chdir(cwd)
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
test_main()
|
unittest.main()
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import threading
|
import threading
|
||||||
|
import unittest
|
||||||
import weakref
|
import weakref
|
||||||
|
|
||||||
from test import support
|
from test import support
|
||||||
|
|
@ -139,15 +140,10 @@ def test_all_locks(self):
|
||||||
) = test_util.test_both(LifetimeTests, init=init)
|
) = test_util.test_both(LifetimeTests, init=init)
|
||||||
|
|
||||||
|
|
||||||
@threading_helper.reap_threads
|
def setUpModule():
|
||||||
def test_main():
|
thread_info = threading_helper.threading_setup()
|
||||||
support.run_unittest(Frozen_ModuleLockAsRLockTests,
|
unittest.addModuleCleanup(threading_helper.threading_cleanup, *thread_info)
|
||||||
Source_ModuleLockAsRLockTests,
|
|
||||||
Frozen_DeadlockAvoidanceTests,
|
|
||||||
Source_DeadlockAvoidanceTests,
|
|
||||||
Frozen_LifetimeTests,
|
|
||||||
Source_LifetimeTests)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
test_main()
|
unittets.main()
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
import threading
|
import threading
|
||||||
import unittest
|
import unittest
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
from test.support import (verbose, run_unittest)
|
from test.support import verbose
|
||||||
from test.support.import_helper import forget
|
from test.support.import_helper import forget
|
||||||
from test.support.os_helper import (TESTFN, unlink, rmtree)
|
from test.support.os_helper import (TESTFN, unlink, rmtree)
|
||||||
from test.support import script_helper, threading_helper
|
from test.support import script_helper, threading_helper
|
||||||
|
|
@ -258,19 +258,16 @@ def test_multiprocessing_pool_circular_import(self):
|
||||||
script_helper.assert_python_ok(fn)
|
script_helper.assert_python_ok(fn)
|
||||||
|
|
||||||
|
|
||||||
@threading_helper.reap_threads
|
def setUpModule():
|
||||||
def test_main():
|
thread_info = threading_helper.threading_setup()
|
||||||
old_switchinterval = None
|
unittest.addModuleCleanup(threading_helper.threading_cleanup, *thread_info)
|
||||||
try:
|
try:
|
||||||
old_switchinterval = sys.getswitchinterval()
|
old_switchinterval = sys.getswitchinterval()
|
||||||
|
unittest.addModuleCleanup(sys.setswitchinterval, old_switchinterval)
|
||||||
sys.setswitchinterval(1e-5)
|
sys.setswitchinterval(1e-5)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
pass
|
pass
|
||||||
try:
|
|
||||||
run_unittest(ThreadedImportTests)
|
|
||||||
finally:
|
|
||||||
if old_switchinterval is not None:
|
|
||||||
sys.setswitchinterval(old_switchinterval)
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
unittets.main()
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@
|
||||||
except ImportError:
|
except ImportError:
|
||||||
ThreadPoolExecutor = None
|
ThreadPoolExecutor = None
|
||||||
|
|
||||||
from test.support import run_unittest, cpython_only
|
from test.support import cpython_only
|
||||||
from test.support import MISSING_C_DOCSTRINGS, ALWAYS_EQ
|
from test.support import MISSING_C_DOCSTRINGS, ALWAYS_EQ
|
||||||
from test.support.import_helper import DirsOnSysPath
|
from test.support.import_helper import DirsOnSysPath
|
||||||
from test.support.os_helper import TESTFN
|
from test.support.os_helper import TESTFN
|
||||||
|
|
@ -4350,19 +4350,5 @@ def test_getsource_reload(self):
|
||||||
self.assertInspectEqual(path, module)
|
self.assertInspectEqual(path, module)
|
||||||
|
|
||||||
|
|
||||||
def test_main():
|
|
||||||
run_unittest(
|
|
||||||
TestDecorators, TestRetrievingSourceCode, TestOneliners, TestBlockComments,
|
|
||||||
TestBuggyCases, TestInterpreterStack, TestClassesAndFunctions, TestPredicates,
|
|
||||||
TestGetcallargsFunctions, TestGetcallargsMethods,
|
|
||||||
TestGetcallargsUnboundMethods, TestGetattrStatic, TestGetGeneratorState,
|
|
||||||
TestNoEOL, TestSignatureObject, TestSignatureBind, TestParameterObject,
|
|
||||||
TestBoundArguments, TestSignaturePrivateHelpers,
|
|
||||||
TestSignatureDefinitions, TestIsDataDescriptor,
|
|
||||||
TestGetClosureVars, TestUnwrap, TestMain, TestReload,
|
|
||||||
TestGetCoroutineState, TestGettingSourceOfToplevelFrames,
|
|
||||||
TestGetsourceInteractive,
|
|
||||||
)
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
unittest.main()
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import unittest
|
import unittest
|
||||||
from test.support import run_unittest, cpython_only
|
from test.support import cpython_only
|
||||||
from test.support.os_helper import TESTFN, unlink
|
from test.support.os_helper import TESTFN, unlink
|
||||||
from test.support import check_free_after_iterating, ALWAYS_EQ, NEVER_EQ
|
from test.support import check_free_after_iterating, ALWAYS_EQ, NEVER_EQ
|
||||||
import pickle
|
import pickle
|
||||||
|
|
@ -1037,9 +1037,5 @@ def test_error_iter(self):
|
||||||
self.assertRaises(ZeroDivisionError, iter, BadIterableClass())
|
self.assertRaises(ZeroDivisionError, iter, BadIterableClass())
|
||||||
|
|
||||||
|
|
||||||
def test_main():
|
|
||||||
run_unittest(TestCase)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
unittest.main()
|
||||||
|
|
|
||||||
|
|
@ -5488,25 +5488,11 @@ def test__all__(self):
|
||||||
# Set the locale to the platform-dependent default. I have no idea
|
# Set the locale to the platform-dependent default. I have no idea
|
||||||
# why the test does this, but in any case we save the current locale
|
# why the test does this, but in any case we save the current locale
|
||||||
# first and restore it at the end.
|
# first and restore it at the end.
|
||||||
@support.run_with_locale('LC_ALL', '')
|
def setUpModule():
|
||||||
def test_main():
|
cm = support.run_with_locale('LC_ALL', '')
|
||||||
tests = [
|
cm.__enter__()
|
||||||
BuiltinLevelsTest, BasicFilterTest, CustomLevelsAndFiltersTest,
|
unittest.addModuleCleanup(cm.__exit__, None, None, None)
|
||||||
HandlerTest, MemoryHandlerTest, ConfigFileTest, SocketHandlerTest,
|
|
||||||
DatagramHandlerTest, MemoryTest, EncodingTest, WarningsTest,
|
|
||||||
ConfigDictTest, ManagerTest, FormatterTest, BufferingFormatterTest,
|
|
||||||
StreamHandlerTest, LogRecordFactoryTest, ChildLoggerTest,
|
|
||||||
QueueHandlerTest, ShutdownTest, ModuleLevelMiscTest, BasicConfigTest,
|
|
||||||
LoggerAdapterTest, LoggerTest, SMTPHandlerTest, FileHandlerTest,
|
|
||||||
RotatingFileHandlerTest, LastResortTest, LogRecordTest,
|
|
||||||
ExceptionTest, SysLogHandlerTest, IPv6SysLogHandlerTest, HTTPHandlerTest,
|
|
||||||
NTEventLogHandlerTest, TimedRotatingFileHandlerTest,
|
|
||||||
UnixSocketHandlerTest, UnixDatagramHandlerTest, UnixSysLogHandlerTest,
|
|
||||||
MiscTestCase
|
|
||||||
]
|
|
||||||
if hasattr(logging.handlers, 'QueueListener'):
|
|
||||||
tests.append(QueueListenerTest)
|
|
||||||
support.run_unittest(*tests)
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
unittest.main()
|
||||||
|
|
|
||||||
|
|
@ -9,9 +9,7 @@
|
||||||
from test import support
|
from test import support
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from test.support import (
|
from test.support import _4G, bigmemtest
|
||||||
_4G, bigmemtest, run_unittest
|
|
||||||
)
|
|
||||||
from test.support.import_helper import import_module
|
from test.support.import_helper import import_module
|
||||||
from test.support.os_helper import (
|
from test.support.os_helper import (
|
||||||
TESTFN, unlink
|
TESTFN, unlink
|
||||||
|
|
@ -1941,14 +1939,5 @@ def test_filter_properties_roundtrip(self):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def test_main():
|
|
||||||
run_unittest(
|
|
||||||
CompressorDecompressorTestCase,
|
|
||||||
CompressDecompressFunctionTestCase,
|
|
||||||
FileTestCase,
|
|
||||||
OpenTestCase,
|
|
||||||
MiscellaneousTestCase,
|
|
||||||
)
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
unittest.main()
|
||||||
|
|
|
||||||
|
|
@ -2300,15 +2300,9 @@ def test__all__(self):
|
||||||
not_exported={"linesep", "fcntl"})
|
not_exported={"linesep", "fcntl"})
|
||||||
|
|
||||||
|
|
||||||
def test_main():
|
def tearDownModule():
|
||||||
tests = (TestMailboxSuperclass, TestMaildir, TestMbox, TestMMDF, TestMH,
|
|
||||||
TestBabyl, TestMessage, TestMaildirMessage, TestMboxMessage,
|
|
||||||
TestMHMessage, TestBabylMessage, TestMMDFMessage,
|
|
||||||
TestMessageConversion, TestProxyFile, TestPartialFile,
|
|
||||||
MaildirTestCase, TestFakeMailBox, MiscTestCase)
|
|
||||||
support.run_unittest(*tests)
|
|
||||||
support.reap_children()
|
support.reap_children()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
test_main()
|
unittest.main()
|
||||||
|
|
|
||||||
|
|
@ -403,8 +403,6 @@ class TestHZStateful(TestStateful):
|
||||||
reset = b'~}'
|
reset = b'~}'
|
||||||
expected_reset = expected + reset
|
expected_reset = expected + reset
|
||||||
|
|
||||||
def test_main():
|
|
||||||
support.run_unittest(__name__)
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
unittest.main()
|
||||||
|
|
|
||||||
|
|
@ -1656,8 +1656,5 @@ def test__all__(self):
|
||||||
support.check__all__(self, optparse, not_exported=not_exported)
|
support.check__all__(self, optparse, not_exported=not_exported)
|
||||||
|
|
||||||
|
|
||||||
def test_main():
|
|
||||||
support.run_unittest(__name__)
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
test_main()
|
unittest.main()
|
||||||
|
|
|
||||||
|
|
@ -188,7 +188,7 @@ def test_on_closed(self):
|
||||||
mixer.close()
|
mixer.close()
|
||||||
self.assertRaises(ValueError, mixer.fileno)
|
self.assertRaises(ValueError, mixer.fileno)
|
||||||
|
|
||||||
def test_main():
|
def setUpModule():
|
||||||
try:
|
try:
|
||||||
dsp = ossaudiodev.open('w')
|
dsp = ossaudiodev.open('w')
|
||||||
except (ossaudiodev.error, OSError) as msg:
|
except (ossaudiodev.error, OSError) as msg:
|
||||||
|
|
@ -197,7 +197,6 @@ def test_main():
|
||||||
raise unittest.SkipTest(msg)
|
raise unittest.SkipTest(msg)
|
||||||
raise
|
raise
|
||||||
dsp.close()
|
dsp.close()
|
||||||
support.run_unittest(__name__)
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
unittest.main()
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
import string
|
import string
|
||||||
import unittest
|
import unittest
|
||||||
import shutil
|
import shutil
|
||||||
from test.support import run_unittest, reap_children, unix_shell
|
from test.support import reap_children, unix_shell
|
||||||
from test.support.os_helper import TESTFN, unlink
|
from test.support.os_helper import TESTFN, unlink
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -199,9 +199,10 @@ def testClone(self):
|
||||||
self.assertNotEqual(id(t.steps), id(u.steps))
|
self.assertNotEqual(id(t.steps), id(u.steps))
|
||||||
self.assertEqual(t.debugging, u.debugging)
|
self.assertEqual(t.debugging, u.debugging)
|
||||||
|
|
||||||
def test_main():
|
|
||||||
run_unittest(SimplePipeTests)
|
def tearDownModule():
|
||||||
reap_children()
|
reap_children()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
unittest.main()
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
from test.support import run_unittest
|
|
||||||
from test.support.import_helper import unload, CleanImport
|
from test.support.import_helper import unload, CleanImport
|
||||||
from test.support.warnings_helper import check_warnings
|
from test.support.warnings_helper import check_warnings
|
||||||
import unittest
|
import unittest
|
||||||
|
|
@ -580,9 +579,7 @@ def test_iter_importers_avoids_emulation(self):
|
||||||
self.assertEqual(len(w.warnings), 0)
|
self.assertEqual(len(w.warnings), 0)
|
||||||
|
|
||||||
|
|
||||||
def test_main():
|
def tearDownModule():
|
||||||
run_unittest(PkgutilTests, PkgutilPEP302Tests, ExtendPathTests,
|
|
||||||
NestedNamespacePackageTest, ImportlibMigrationTests)
|
|
||||||
# this is necessary if test is run repeated (like when finding leaks)
|
# this is necessary if test is run repeated (like when finding leaks)
|
||||||
import zipimport
|
import zipimport
|
||||||
import importlib
|
import importlib
|
||||||
|
|
@ -591,4 +588,4 @@ def test_main():
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
test_main()
|
unittest.main()
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
import unittest
|
import unittest
|
||||||
from test.support import run_unittest, cpython_only
|
from test.support import cpython_only
|
||||||
from test.support import threading_helper
|
from test.support import threading_helper
|
||||||
from test.support.os_helper import TESTFN
|
from test.support.os_helper import TESTFN
|
||||||
|
|
||||||
|
|
@ -229,8 +229,5 @@ def test_poll_blocks_with_negative_ms(self):
|
||||||
os.close(w)
|
os.close(w)
|
||||||
|
|
||||||
|
|
||||||
def test_main():
|
|
||||||
run_unittest(PollTests)
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
test_main()
|
unittest.main()
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@
|
||||||
import errno
|
import errno
|
||||||
import threading
|
import threading
|
||||||
|
|
||||||
|
import unittest
|
||||||
from unittest import TestCase, skipUnless
|
from unittest import TestCase, skipUnless
|
||||||
from test import support as test_support
|
from test import support as test_support
|
||||||
from test.support import hashlib_helper
|
from test.support import hashlib_helper
|
||||||
|
|
@ -538,15 +539,10 @@ def testTimeoutValue(self):
|
||||||
poplib.POP3(HOST, self.port, timeout=0)
|
poplib.POP3(HOST, self.port, timeout=0)
|
||||||
|
|
||||||
|
|
||||||
def test_main():
|
def setUpModule():
|
||||||
tests = [TestPOP3Class, TestTimeouts,
|
|
||||||
TestPOP3_SSLClass, TestPOP3_TLSClass]
|
|
||||||
thread_info = threading_helper.threading_setup()
|
thread_info = threading_helper.threading_setup()
|
||||||
try:
|
unittest.addModuleCleanup(threading_helper.threading_cleanup, *thread_info)
|
||||||
test_support.run_unittest(*tests)
|
|
||||||
finally:
|
|
||||||
threading_helper.threading_cleanup(*thread_info)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
test_main()
|
unittest.main()
|
||||||
|
|
|
||||||
|
|
@ -2171,17 +2171,9 @@ def test_utime(self):
|
||||||
os.utime("path", dir_fd=0)
|
os.utime("path", dir_fd=0)
|
||||||
|
|
||||||
|
|
||||||
def test_main():
|
def tearDownModule():
|
||||||
try:
|
support.reap_children()
|
||||||
support.run_unittest(
|
|
||||||
PosixTester,
|
|
||||||
PosixGroupsTester,
|
|
||||||
TestPosixSpawn,
|
|
||||||
TestPosixSpawnP,
|
|
||||||
TestPosixWeaklinking
|
|
||||||
)
|
|
||||||
finally:
|
|
||||||
support.reap_children()
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
test_main()
|
unittest.main()
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@
|
||||||
import os
|
import os
|
||||||
from difflib import unified_diff
|
from difflib import unified_diff
|
||||||
from io import StringIO
|
from io import StringIO
|
||||||
from test.support import run_unittest
|
|
||||||
from test.support.os_helper import TESTFN, unlink, temp_dir, change_cwd
|
from test.support.os_helper import TESTFN, unlink, temp_dir, change_cwd
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
|
|
||||||
|
|
@ -156,12 +155,10 @@ def silent():
|
||||||
finally:
|
finally:
|
||||||
sys.stdout = stdout
|
sys.stdout = stdout
|
||||||
|
|
||||||
def test_main():
|
|
||||||
run_unittest(ProfileTest)
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
if '-r' not in sys.argv:
|
if '-r' not in sys.argv:
|
||||||
test_main()
|
unittest.main()
|
||||||
else:
|
else:
|
||||||
regenerate_expected_output(__file__, ProfileTest)
|
regenerate_expected_output(__file__, ProfileTest)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1571,20 +1571,11 @@ def test_sys_path_adjustment_when_curdir_already_included(self):
|
||||||
self.assertIsNone(self._get_revised_path(trailing_argv0dir))
|
self.assertIsNone(self._get_revised_path(trailing_argv0dir))
|
||||||
|
|
||||||
|
|
||||||
@threading_helper.reap_threads
|
def setUpModule():
|
||||||
def test_main():
|
thread_info = threading_helper.threading_setup()
|
||||||
try:
|
unittest.addModuleCleanup(threading_helper.threading_cleanup, *thread_info)
|
||||||
test.support.run_unittest(PydocDocTest,
|
unittest.addModuleCleanup(reap_children)
|
||||||
PydocImportTest,
|
|
||||||
TestDescriptions,
|
|
||||||
PydocServerTest,
|
|
||||||
PydocUrlHandlerTest,
|
|
||||||
TestHelper,
|
|
||||||
PydocWithMetaClasses,
|
|
||||||
TestInternalUtilities,
|
|
||||||
)
|
|
||||||
finally:
|
|
||||||
reap_children()
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
unittest.main()
|
||||||
|
|
|
||||||
|
|
@ -174,8 +174,5 @@ def __getitem__(self, key):
|
||||||
limits)
|
limits)
|
||||||
|
|
||||||
|
|
||||||
def test_main(verbose=None):
|
|
||||||
support.run_unittest(ResourceTest)
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
unittest.main()
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@
|
||||||
from urllib.error import URLError
|
from urllib.error import URLError
|
||||||
import urllib.request
|
import urllib.request
|
||||||
from test.support import os_helper
|
from test.support import os_helper
|
||||||
from test.support import findfile, run_unittest
|
from test.support import findfile
|
||||||
from test.support.os_helper import FakePath, TESTFN
|
from test.support.os_helper import FakePath, TESTFN
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1506,22 +1506,5 @@ def characters(self, content):
|
||||||
self.assertEqual(self.char_index, 2)
|
self.assertEqual(self.char_index, 2)
|
||||||
|
|
||||||
|
|
||||||
def test_main():
|
|
||||||
run_unittest(MakeParserTest,
|
|
||||||
ParseTest,
|
|
||||||
SaxutilsTest,
|
|
||||||
PrepareInputSourceTest,
|
|
||||||
StringXmlgenTest,
|
|
||||||
BytesXmlgenTest,
|
|
||||||
WriterXmlgenTest,
|
|
||||||
StreamWriterXmlgenTest,
|
|
||||||
StreamReaderWriterXmlgenTest,
|
|
||||||
ExpatReaderTest,
|
|
||||||
ErrorReportingTest,
|
|
||||||
XmlReaderTest,
|
|
||||||
LexicalHandlerTest,
|
|
||||||
CDATAHandlerTest)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
unittest.main()
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ def find_ready_matching(ready, flag):
|
||||||
return match
|
return match
|
||||||
|
|
||||||
|
|
||||||
class BaseSelectorTestCase(unittest.TestCase):
|
class BaseSelectorTestCase:
|
||||||
|
|
||||||
def make_socketpair(self):
|
def make_socketpair(self):
|
||||||
rd, wr = socketpair()
|
rd, wr = socketpair()
|
||||||
|
|
@ -493,26 +493,28 @@ def test_above_fd_setsize(self):
|
||||||
self.assertEqual(NUM_FDS // 2, len(fds))
|
self.assertEqual(NUM_FDS // 2, len(fds))
|
||||||
|
|
||||||
|
|
||||||
class DefaultSelectorTestCase(BaseSelectorTestCase):
|
class DefaultSelectorTestCase(BaseSelectorTestCase, unittest.TestCase):
|
||||||
|
|
||||||
SELECTOR = selectors.DefaultSelector
|
SELECTOR = selectors.DefaultSelector
|
||||||
|
|
||||||
|
|
||||||
class SelectSelectorTestCase(BaseSelectorTestCase):
|
class SelectSelectorTestCase(BaseSelectorTestCase, unittest.TestCase):
|
||||||
|
|
||||||
SELECTOR = selectors.SelectSelector
|
SELECTOR = selectors.SelectSelector
|
||||||
|
|
||||||
|
|
||||||
@unittest.skipUnless(hasattr(selectors, 'PollSelector'),
|
@unittest.skipUnless(hasattr(selectors, 'PollSelector'),
|
||||||
"Test needs selectors.PollSelector")
|
"Test needs selectors.PollSelector")
|
||||||
class PollSelectorTestCase(BaseSelectorTestCase, ScalableSelectorMixIn):
|
class PollSelectorTestCase(BaseSelectorTestCase, ScalableSelectorMixIn,
|
||||||
|
unittest.TestCase):
|
||||||
|
|
||||||
SELECTOR = getattr(selectors, 'PollSelector', None)
|
SELECTOR = getattr(selectors, 'PollSelector', None)
|
||||||
|
|
||||||
|
|
||||||
@unittest.skipUnless(hasattr(selectors, 'EpollSelector'),
|
@unittest.skipUnless(hasattr(selectors, 'EpollSelector'),
|
||||||
"Test needs selectors.EpollSelector")
|
"Test needs selectors.EpollSelector")
|
||||||
class EpollSelectorTestCase(BaseSelectorTestCase, ScalableSelectorMixIn):
|
class EpollSelectorTestCase(BaseSelectorTestCase, ScalableSelectorMixIn,
|
||||||
|
unittest.TestCase):
|
||||||
|
|
||||||
SELECTOR = getattr(selectors, 'EpollSelector', None)
|
SELECTOR = getattr(selectors, 'EpollSelector', None)
|
||||||
|
|
||||||
|
|
@ -529,7 +531,8 @@ def test_register_file(self):
|
||||||
|
|
||||||
@unittest.skipUnless(hasattr(selectors, 'KqueueSelector'),
|
@unittest.skipUnless(hasattr(selectors, 'KqueueSelector'),
|
||||||
"Test needs selectors.KqueueSelector)")
|
"Test needs selectors.KqueueSelector)")
|
||||||
class KqueueSelectorTestCase(BaseSelectorTestCase, ScalableSelectorMixIn):
|
class KqueueSelectorTestCase(BaseSelectorTestCase, ScalableSelectorMixIn,
|
||||||
|
unittest.TestCase):
|
||||||
|
|
||||||
SELECTOR = getattr(selectors, 'KqueueSelector', None)
|
SELECTOR = getattr(selectors, 'KqueueSelector', None)
|
||||||
|
|
||||||
|
|
@ -561,19 +564,15 @@ def test_empty_select_timeout(self):
|
||||||
|
|
||||||
@unittest.skipUnless(hasattr(selectors, 'DevpollSelector'),
|
@unittest.skipUnless(hasattr(selectors, 'DevpollSelector'),
|
||||||
"Test needs selectors.DevpollSelector")
|
"Test needs selectors.DevpollSelector")
|
||||||
class DevpollSelectorTestCase(BaseSelectorTestCase, ScalableSelectorMixIn):
|
class DevpollSelectorTestCase(BaseSelectorTestCase, ScalableSelectorMixIn,
|
||||||
|
unittest.TestCase):
|
||||||
|
|
||||||
SELECTOR = getattr(selectors, 'DevpollSelector', None)
|
SELECTOR = getattr(selectors, 'DevpollSelector', None)
|
||||||
|
|
||||||
|
|
||||||
|
def tearDownModule():
|
||||||
def test_main():
|
|
||||||
tests = [DefaultSelectorTestCase, SelectSelectorTestCase,
|
|
||||||
PollSelectorTestCase, EpollSelectorTestCase,
|
|
||||||
KqueueSelectorTestCase, DevpollSelectorTestCase]
|
|
||||||
support.run_unittest(*tests)
|
|
||||||
support.reap_children()
|
support.reap_children()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
unittest.main()
|
||||||
|
|
|
||||||
|
|
@ -2343,6 +2343,7 @@ def test_bio_read_write_data(self):
|
||||||
self.ssl_io_loop(sock, incoming, outgoing, sslobj.unwrap)
|
self.ssl_io_loop(sock, incoming, outgoing, sslobj.unwrap)
|
||||||
|
|
||||||
|
|
||||||
|
@support.requires_resource('network')
|
||||||
class NetworkedTests(unittest.TestCase):
|
class NetworkedTests(unittest.TestCase):
|
||||||
|
|
||||||
def test_timeout_connect_ex(self):
|
def test_timeout_connect_ex(self):
|
||||||
|
|
@ -4869,7 +4870,7 @@ def sni_cb(sock, servername, ctx):
|
||||||
s.connect((HOST, server.port))
|
s.connect((HOST, server.port))
|
||||||
|
|
||||||
|
|
||||||
def test_main(verbose=False):
|
def setUpModule():
|
||||||
if support.verbose:
|
if support.verbose:
|
||||||
plats = {
|
plats = {
|
||||||
'Mac': platform.mac_ver,
|
'Mac': platform.mac_ver,
|
||||||
|
|
@ -4900,20 +4901,9 @@ def test_main(verbose=False):
|
||||||
if not os.path.exists(filename):
|
if not os.path.exists(filename):
|
||||||
raise support.TestFailed("Can't read certificate file %r" % filename)
|
raise support.TestFailed("Can't read certificate file %r" % filename)
|
||||||
|
|
||||||
tests = [
|
|
||||||
ContextTests, BasicSocketTests, SSLErrorTests, MemoryBIOTests,
|
|
||||||
SSLObjectTests, SimpleBackgroundTests, ThreadedTests,
|
|
||||||
TestPostHandshakeAuth, TestSSLDebug
|
|
||||||
]
|
|
||||||
|
|
||||||
if support.is_resource_enabled('network'):
|
|
||||||
tests.append(NetworkedTests)
|
|
||||||
|
|
||||||
thread_info = threading_helper.threading_setup()
|
thread_info = threading_helper.threading_setup()
|
||||||
try:
|
unittest.addModuleCleanup(threading_helper.threading_cleanup, *thread_info)
|
||||||
support.run_unittest(*tests)
|
|
||||||
finally:
|
|
||||||
threading_helper.threading_cleanup(*thread_info)
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
unittest.main()
|
||||||
|
|
|
||||||
|
|
@ -709,9 +709,5 @@ def test_print_warning(self):
|
||||||
# SuppressCrashReport
|
# SuppressCrashReport
|
||||||
|
|
||||||
|
|
||||||
def test_main():
|
|
||||||
tests = [TestSupport]
|
|
||||||
support.run_unittest(*tests)
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
test_main()
|
unittest.main()
|
||||||
|
|
|
||||||
|
|
@ -804,8 +804,5 @@ def setUpModule():
|
||||||
print('patchlevel =', tcl.call('info', 'patchlevel'))
|
print('patchlevel =', tcl.call('info', 'patchlevel'))
|
||||||
|
|
||||||
|
|
||||||
def test_main():
|
|
||||||
support.run_unittest(TclTest, TkinterTest, BigmemTclTest)
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
unittest.main()
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@
|
||||||
import signal
|
import signal
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
from test import support
|
|
||||||
from test.support import threading_helper
|
from test.support import threading_helper
|
||||||
import _thread as thread
|
import _thread as thread
|
||||||
import time
|
import time
|
||||||
|
|
@ -231,7 +230,7 @@ def send_signals():
|
||||||
signal.signal(signal.SIGUSR1, old_handler)
|
signal.signal(signal.SIGUSR1, old_handler)
|
||||||
|
|
||||||
|
|
||||||
def test_main():
|
def setUpModule():
|
||||||
global signal_blackboard
|
global signal_blackboard
|
||||||
|
|
||||||
signal_blackboard = { signal.SIGUSR1 : {'tripped': 0, 'tripped_by': 0 },
|
signal_blackboard = { signal.SIGUSR1 : {'tripped': 0, 'tripped_by': 0 },
|
||||||
|
|
@ -239,10 +238,8 @@ def test_main():
|
||||||
signal.SIGALRM : {'tripped': 0, 'tripped_by': 0 } }
|
signal.SIGALRM : {'tripped': 0, 'tripped_by': 0 } }
|
||||||
|
|
||||||
oldsigs = registerSignals(handle_signals, handle_signals, handle_signals)
|
oldsigs = registerSignals(handle_signals, handle_signals, handle_signals)
|
||||||
try:
|
unittest.addModuleCleanup(registerSignals, *oldsigs)
|
||||||
support.run_unittest(ThreadSignals)
|
|
||||||
finally:
|
|
||||||
registerSignals(*oldsigs)
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
test_main()
|
unittest.main()
|
||||||
|
|
|
||||||
|
|
@ -290,13 +290,9 @@ def testRecvfromTimeout(self):
|
||||||
self._sock_operation(1, 1.5, 'recvfrom', 1024)
|
self._sock_operation(1, 1.5, 'recvfrom', 1024)
|
||||||
|
|
||||||
|
|
||||||
def test_main():
|
def setUpModule():
|
||||||
support.requires('network')
|
support.requires('network')
|
||||||
support.run_unittest(
|
|
||||||
CreationTestCase,
|
|
||||||
TCPTimeoutTestCase,
|
|
||||||
UDPTimeoutTestCase,
|
|
||||||
)
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
unittest.main()
|
||||||
|
|
|
||||||
|
|
@ -1082,15 +1082,5 @@ def test_stop_untrack(self):
|
||||||
self.untrack()
|
self.untrack()
|
||||||
|
|
||||||
|
|
||||||
def test_main():
|
|
||||||
support.run_unittest(
|
|
||||||
TestTraceback,
|
|
||||||
TestTracemallocEnabled,
|
|
||||||
TestSnapshot,
|
|
||||||
TestFilters,
|
|
||||||
TestCommandLine,
|
|
||||||
TestCAPI,
|
|
||||||
)
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
unittest.main()
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@
|
||||||
import unicodedata
|
import unicodedata
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
from test.support import run_unittest
|
|
||||||
from test.support.os_helper import (rmtree, change_cwd, TESTFN_UNICODE,
|
from test.support.os_helper import (rmtree, change_cwd, TESTFN_UNICODE,
|
||||||
TESTFN_UNENCODABLE, create_empty_file)
|
TESTFN_UNENCODABLE, create_empty_file)
|
||||||
|
|
||||||
|
|
@ -136,8 +135,6 @@ def test_directories(self):
|
||||||
self._do_directory(TESTFN_UNENCODABLE+ext,
|
self._do_directory(TESTFN_UNENCODABLE+ext,
|
||||||
TESTFN_UNENCODABLE+ext)
|
TESTFN_UNENCODABLE+ext)
|
||||||
|
|
||||||
def test_main():
|
|
||||||
run_unittest(__name__)
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
unittest.main()
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@
|
||||||
import unittest
|
import unittest
|
||||||
import warnings
|
import warnings
|
||||||
from unicodedata import normalize
|
from unicodedata import normalize
|
||||||
from test import support
|
|
||||||
from test.support import os_helper
|
from test.support import os_helper
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -185,15 +184,5 @@ class UnicodeNFKDFileTests(UnicodeFileTests):
|
||||||
normal_form = 'NFKD'
|
normal_form = 'NFKD'
|
||||||
|
|
||||||
|
|
||||||
def test_main():
|
|
||||||
support.run_unittest(
|
|
||||||
UnicodeFileTests,
|
|
||||||
UnicodeNFCFileTests,
|
|
||||||
UnicodeNFDFileTests,
|
|
||||||
UnicodeNFKCFileTests,
|
|
||||||
UnicodeNFKDFileTests,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
unittest.main()
|
||||||
|
|
|
||||||
|
|
@ -3,14 +3,14 @@
|
||||||
from test import support
|
from test import support
|
||||||
|
|
||||||
|
|
||||||
def test_main():
|
|
||||||
# used by regrtest
|
|
||||||
support.run_unittest(unittest.test.suite())
|
|
||||||
support.reap_children()
|
|
||||||
|
|
||||||
def load_tests(*_):
|
def load_tests(*_):
|
||||||
# used by unittest
|
# used by unittest
|
||||||
return unittest.test.suite()
|
return unittest.test.suite()
|
||||||
|
|
||||||
|
|
||||||
|
def tearDownModule():
|
||||||
|
support.reap_children()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
unittest.main()
|
||||||
|
|
|
||||||
|
|
@ -661,17 +661,10 @@ def test_line_iteration(self):
|
||||||
self.assertEqual(index + 1, len(lines))
|
self.assertEqual(index + 1, len(lines))
|
||||||
|
|
||||||
|
|
||||||
threads_key = None
|
|
||||||
|
|
||||||
def setUpModule():
|
def setUpModule():
|
||||||
# Store the threading_setup in a key and ensure that it is cleaned up
|
thread_info = threading_helper.threading_setup()
|
||||||
# in the tearDown
|
unittest.addModuleCleanup(threading_helper.threading_cleanup, *thread_info)
|
||||||
global threads_key
|
|
||||||
threads_key = threading_helper.threading_setup()
|
|
||||||
|
|
||||||
def tearDownModule():
|
|
||||||
if threads_key:
|
|
||||||
threading_helper.threading_cleanup(*threads_key)
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@
|
||||||
|
|
||||||
import os, sys, errno
|
import os, sys, errno
|
||||||
import unittest
|
import unittest
|
||||||
from test import support
|
|
||||||
from test.support import import_helper
|
from test.support import import_helper
|
||||||
import threading
|
import threading
|
||||||
from platform import machine, win32_edition
|
from platform import machine, win32_edition
|
||||||
|
|
@ -490,12 +489,9 @@ def test_exception_numbers(self):
|
||||||
with self.assertRaises(FileNotFoundError) as ctx:
|
with self.assertRaises(FileNotFoundError) as ctx:
|
||||||
QueryValue(HKEY_CLASSES_ROOT, 'some_value_that_does_not_exist')
|
QueryValue(HKEY_CLASSES_ROOT, 'some_value_that_does_not_exist')
|
||||||
|
|
||||||
def test_main():
|
|
||||||
support.run_unittest(LocalWinregTests, RemoteWinregTests,
|
|
||||||
Win64WinregTests)
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
if not REMOTE_NAME:
|
if not REMOTE_NAME:
|
||||||
print("Remote registry calls can be tested using",
|
print("Remote registry calls can be tested using",
|
||||||
"'test_winreg.py --remote \\\\machine_name'")
|
"'test_winreg.py --remote \\\\machine_name'")
|
||||||
test_main()
|
unittest.main()
|
||||||
|
|
|
||||||
|
|
@ -1504,16 +1504,10 @@ def test_xmlrpcserver_has_use_builtin_types_flag(self):
|
||||||
self.assertTrue(server.use_builtin_types)
|
self.assertTrue(server.use_builtin_types)
|
||||||
|
|
||||||
|
|
||||||
@threading_helper.reap_threads
|
def setUpModule():
|
||||||
def test_main():
|
thread_info = threading_helper.threading_setup()
|
||||||
support.run_unittest(XMLRPCTestCase, HelperTestCase, DateTimeTestCase,
|
unittest.addModuleCleanup(threading_helper.threading_cleanup, *thread_info)
|
||||||
BinaryTestCase, FaultTestCase, UseBuiltinTypesTestCase,
|
|
||||||
SimpleServerTestCase, SimpleServerEncodingTestCase,
|
|
||||||
KeepaliveServerTestCase1, KeepaliveServerTestCase2,
|
|
||||||
GzipServerTestCase, GzipUtilTestCase, HeadersServerTestCase,
|
|
||||||
MultiPathServerTestCase, ServerProxyTestCase, FailingServerTestCase,
|
|
||||||
CGIHandlerTestCase, SimpleXMLRPCDispatcherTestCase)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
unittest.main()
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,9 @@
|
||||||
import xmlrpc.client as xmlrpclib
|
import xmlrpc.client as xmlrpclib
|
||||||
|
|
||||||
|
|
||||||
|
support.requires("network")
|
||||||
|
|
||||||
|
|
||||||
@unittest.skip('XXX: buildbot.python.org/all/xmlrpc/ is gone')
|
@unittest.skip('XXX: buildbot.python.org/all/xmlrpc/ is gone')
|
||||||
class PythonBuildersTest(unittest.TestCase):
|
class PythonBuildersTest(unittest.TestCase):
|
||||||
|
|
||||||
|
|
@ -24,9 +27,5 @@ def test_python_builders(self):
|
||||||
self.assertTrue([x for x in builders if "3.x" in x], builders)
|
self.assertTrue([x for x in builders if "3.x" in x], builders)
|
||||||
|
|
||||||
|
|
||||||
def test_main():
|
|
||||||
support.requires("network")
|
|
||||||
support.run_unittest(PythonBuildersTest)
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
unittest.main()
|
||||||
|
|
|
||||||
|
|
@ -856,15 +856,9 @@ def _testBogusZipFile(self):
|
||||||
zipimport._zip_directory_cache.clear()
|
zipimport._zip_directory_cache.clear()
|
||||||
|
|
||||||
|
|
||||||
def test_main():
|
def tearDownModule():
|
||||||
try:
|
os_helper.unlink(TESTMOD)
|
||||||
support.run_unittest(
|
|
||||||
UncompressedZipImportTestCase,
|
|
||||||
CompressedZipImportTestCase,
|
|
||||||
BadFileZipImportTestCase,
|
|
||||||
)
|
|
||||||
finally:
|
|
||||||
os_helper.unlink(TESTMOD)
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
unittest.main()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue