summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_ast.py5
-rw-r--r--Lib/test/test_asynchat.py6
-rw-r--r--Lib/test/test_buffer.py6
-rw-r--r--Lib/test/test_codeccallbacks.py4
-rw-r--r--Lib/test/test_contextlib.py6
-rw-r--r--Lib/test/test_faulthandler.py5
-rw-r--r--Lib/test/test_fileinput.py18
-rw-r--r--Lib/test/test_frozen.py4
-rw-r--r--Lib/test/test_getargs2.py26
-rw-r--r--Lib/test/test_hashlib.py4
-rw-r--r--Lib/test/test_ioctl.py4
-rw-r--r--Lib/test/test_runpy.py9
-rw-r--r--Lib/test/test_sched.py5
-rw-r--r--Lib/test/test_shutil.py6
-rw-r--r--Lib/test/test_site.py4
-rw-r--r--Lib/test/test_strftime.py4
-rw-r--r--Lib/test/test_sundry.py5
-rw-r--r--Lib/test/test_urllib2net.py11
18 files changed, 24 insertions, 108 deletions
diff --git a/Lib/test/test_ast.py b/Lib/test/test_ast.py
index c45326f..49daacb 100644
--- a/Lib/test/test_ast.py
+++ b/Lib/test/test_ast.py
@@ -951,9 +951,6 @@ class ASTValidatorTests(unittest.TestCase):
compile(mod, fn, "exec")
-def test_main():
- support.run_unittest(AST_Tests, ASTHelpers_Test, ASTValidatorTests)
-
def main():
if __name__ != '__main__':
return
@@ -966,7 +963,7 @@ def main():
print("]")
print("main()")
raise SystemExit
- test_main()
+ unittest.main()
#### EVERYTHING BELOW IS GENERATED #####
exec_results = [
diff --git a/Lib/test/test_asynchat.py b/Lib/test/test_asynchat.py
index b616f30..f93a52d 100644
--- a/Lib/test/test_asynchat.py
+++ b/Lib/test/test_asynchat.py
@@ -283,9 +283,5 @@ class TestFifo(unittest.TestCase):
self.assertEqual(f.pop(), (0, None))
-def test_main(verbose=None):
- support.run_unittest(TestAsynchat, TestAsynchat_WithPoll,
- TestHelperFunctions, TestFifo)
-
if __name__ == "__main__":
- test_main(verbose=True)
+ unittest.main()
diff --git a/Lib/test/test_buffer.py b/Lib/test/test_buffer.py
index 747e2a2..a4fb770 100644
--- a/Lib/test/test_buffer.py
+++ b/Lib/test/test_buffer.py
@@ -4283,9 +4283,5 @@ class TestBufferProtocol(unittest.TestCase):
self.assertRaises(BufferError, memoryview, x)
-def test_main():
- support.run_unittest(TestBufferProtocol)
-
-
if __name__ == "__main__":
- test_main()
+ unittest.main()
diff --git a/Lib/test/test_codeccallbacks.py b/Lib/test/test_codeccallbacks.py
index fd88505..84804bb 100644
--- a/Lib/test/test_codeccallbacks.py
+++ b/Lib/test/test_codeccallbacks.py
@@ -875,8 +875,6 @@ class CodecCallbackTest(unittest.TestCase):
with self.assertRaises(TypeError):
data.decode(encoding, "test.replacing")
-def test_main():
- test.support.run_unittest(CodecCallbackTest)
if __name__ == "__main__":
- test_main()
+ unittest.main()
diff --git a/Lib/test/test_contextlib.py b/Lib/test/test_contextlib.py
index d13659d..a38cc48 100644
--- a/Lib/test/test_contextlib.py
+++ b/Lib/test/test_contextlib.py
@@ -617,9 +617,5 @@ class TestIgnored(unittest.TestCase):
'Hello'[50]
-# This is needed to make the test actually run under regrtest.py!
-def test_main():
- support.run_unittest(__name__)
-
if __name__ == "__main__":
- test_main()
+ unittest.main()
diff --git a/Lib/test/test_faulthandler.py b/Lib/test/test_faulthandler.py
index c171faf..fa14ea1 100644
--- a/Lib/test/test_faulthandler.py
+++ b/Lib/test/test_faulthandler.py
@@ -588,8 +588,5 @@ sys.exit(exitcode)
self.check_register(chain=True)
-def test_main():
- support.run_unittest(FaultHandlerTests)
-
if __name__ == "__main__":
- test_main()
+ unittest.main()
diff --git a/Lib/test/test_fileinput.py b/Lib/test/test_fileinput.py
index c42e3e8..c5e57d4 100644
--- a/Lib/test/test_fileinput.py
+++ b/Lib/test/test_fileinput.py
@@ -835,22 +835,6 @@ class Test_hook_encoded(unittest.TestCase):
self.assertIs(kwargs.pop('encoding'), encoding)
self.assertFalse(kwargs)
-def test_main():
- run_unittest(
- BufferSizesTests,
- FileInputTests,
- Test_fileinput_input,
- Test_fileinput_close,
- Test_fileinput_nextfile,
- Test_fileinput_filename,
- Test_fileinput_lineno,
- Test_fileinput_filelineno,
- Test_fileinput_fileno,
- Test_fileinput_isfirstline,
- Test_fileinput_isstdin,
- Test_hook_compressed,
- Test_hook_encoded,
- )
if __name__ == "__main__":
- test_main()
+ unittest.main()
diff --git a/Lib/test/test_frozen.py b/Lib/test/test_frozen.py
index 624e321..4c50cb7 100644
--- a/Lib/test/test_frozen.py
+++ b/Lib/test/test_frozen.py
@@ -72,8 +72,6 @@ class FrozenTests(unittest.TestCase):
del sys.modules['__phello__']
del sys.modules['__phello__.spam']
-def test_main():
- run_unittest(FrozenTests)
if __name__ == "__main__":
- test_main()
+ unittest.main()
diff --git a/Lib/test/test_getargs2.py b/Lib/test/test_getargs2.py
index d75ad30..beea76a 100644
--- a/Lib/test/test_getargs2.py
+++ b/Lib/test/test_getargs2.py
@@ -1,6 +1,10 @@
import unittest
from test import support
from _testcapi import getargs_keywords, getargs_keyword_only
+try:
+ from _testcapi import getargs_L, getargs_K
+except ImportError:
+ getargs_L = None # PY_LONG_LONG not available
# > How about the following counterproposal. This also changes some of
# > the other format codes to be a little more regular.
@@ -182,6 +186,7 @@ class Signed_TestCase(unittest.TestCase):
self.assertRaises(OverflowError, getargs_n, VERY_LARGE)
+@unittest.skipIf(getargs_L is None, 'PY_LONG_LONG is not available')
class LongLong_TestCase(unittest.TestCase):
def test_L(self):
from _testcapi import getargs_L
@@ -534,24 +539,5 @@ class Unicode_TestCase(unittest.TestCase):
self.assertIsNone(getargs_Z_hash(None))
-def test_main():
- tests = [
- Signed_TestCase,
- Unsigned_TestCase,
- Boolean_TestCase,
- Tuple_TestCase,
- Keywords_TestCase,
- KeywordOnly_TestCase,
- Bytes_TestCase,
- Unicode_TestCase,
- ]
- try:
- from _testcapi import getargs_L, getargs_K
- except ImportError:
- pass # PY_LONG_LONG not available
- else:
- tests.append(LongLong_TestCase)
- support.run_unittest(*tests)
-
if __name__ == "__main__":
- test_main()
+ unittest.main()
diff --git a/Lib/test/test_hashlib.py b/Lib/test/test_hashlib.py
index 54201a1..e34c927 100644
--- a/Lib/test/test_hashlib.py
+++ b/Lib/test/test_hashlib.py
@@ -494,8 +494,6 @@ class HashLibTestCase(unittest.TestCase):
self.assertEqual(expected_hash, hasher.hexdigest())
-def test_main():
- support.run_unittest(HashLibTestCase)
if __name__ == "__main__":
- test_main()
+ unittest.main()
diff --git a/Lib/test/test_ioctl.py b/Lib/test/test_ioctl.py
index 7eb324a..efe9f51 100644
--- a/Lib/test/test_ioctl.py
+++ b/Lib/test/test_ioctl.py
@@ -86,8 +86,6 @@ class IoctlTests(unittest.TestCase):
os.close(mfd)
os.close(sfd)
-def test_main():
- run_unittest(IoctlTests)
if __name__ == "__main__":
- test_main()
+ unittest.main()
diff --git a/Lib/test/test_runpy.py b/Lib/test/test_runpy.py
index 2ddba34..16e2e12 100644
--- a/Lib/test/test_runpy.py
+++ b/Lib/test/test_runpy.py
@@ -575,12 +575,5 @@ s = "non-ASCII: h\xe9"
self.assertEqual(result['s'], "non-ASCII: h\xe9")
-def test_main():
- run_unittest(
- ExecutionLayerTestCase,
- RunModuleTestCase,
- RunPathTestCase
- )
-
if __name__ == "__main__":
- test_main()
+ unittest.main()
diff --git a/Lib/test/test_sched.py b/Lib/test/test_sched.py
index 1fe6ad4..853b4d8 100644
--- a/Lib/test/test_sched.py
+++ b/Lib/test/test_sched.py
@@ -197,8 +197,5 @@ class TestCase(unittest.TestCase):
self.assertEqual(l, [])
-def test_main():
- support.run_unittest(TestCase)
-
if __name__ == "__main__":
- test_main()
+ unittest.main()
diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py
index fad924a..e36cb9b 100644
--- a/Lib/test/test_shutil.py
+++ b/Lib/test/test_shutil.py
@@ -1719,9 +1719,5 @@ class TermsizeTests(unittest.TestCase):
self.assertEqual(expected, actual)
-def test_main():
- support.run_unittest(TestShutil, TestMove, TestCopyFile,
- TermsizeTests, TestWhich)
-
if __name__ == '__main__':
- test_main()
+ unittest.main()
diff --git a/Lib/test/test_site.py b/Lib/test/test_site.py
index 06d7bd7..88c2765 100644
--- a/Lib/test/test_site.py
+++ b/Lib/test/test_site.py
@@ -401,8 +401,6 @@ class ImportSideEffectTests(unittest.TestCase):
else:
self.fail("sitecustomize not imported automatically")
-def test_main():
- run_unittest(HelperFunctionsTests, ImportSideEffectTests)
if __name__ == "__main__":
- test_main()
+ unittest.main()
diff --git a/Lib/test/test_strftime.py b/Lib/test/test_strftime.py
index 14057eb..6510c36 100644
--- a/Lib/test/test_strftime.py
+++ b/Lib/test/test_strftime.py
@@ -176,8 +176,6 @@ class StrftimeTest(unittest.TestCase):
(e[0], e[2]))
print(" Expected %s, but got %s" % (e[1], result))
-def test_main():
- support.run_unittest(StrftimeTest)
if __name__ == '__main__':
- test_main()
+ unittest.main()
diff --git a/Lib/test/test_sundry.py b/Lib/test/test_sundry.py
index f171d6f..77ec9f0 100644
--- a/Lib/test/test_sundry.py
+++ b/Lib/test/test_sundry.py
@@ -54,8 +54,5 @@ class TestUntestedModules(unittest.TestCase):
print("skipping tty")
-def test_main():
- support.run_unittest(TestUntestedModules)
-
if __name__ == "__main__":
- test_main()
+ unittest.main()
diff --git a/Lib/test/test_urllib2net.py b/Lib/test/test_urllib2net.py
index b674be0..fba3cea 100644
--- a/Lib/test/test_urllib2net.py
+++ b/Lib/test/test_urllib2net.py
@@ -338,13 +338,6 @@ class TimeoutTest(unittest.TestCase):
self.assertEqual(u.fp.fp.raw._sock.gettimeout(), 60)
-def test_main():
- support.requires("network")
- support.run_unittest(AuthTests,
- OtherNetworkTests,
- CloseSocketTest,
- TimeoutTest,
- )
-
if __name__ == "__main__":
- test_main()
+ support.requires("network")
+ unittest.main()