Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c12f09e

Browse files
committed
Issue #19440: Clean up test_capi
1 parent 0eac43a commit c12f09e

2 files changed

Lines changed: 11 additions & 13 deletions

File tree

Lib/test/test_capi.py

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# Run the _testcapi module tests (tests for the Python/C API): by defn,
22
# these are all functions _testcapi exports whose name begins with 'test_'.
33

4-
from __future__ import with_statement
54
import os
65
import pickle
76
import random
@@ -351,17 +350,12 @@ def callback():
351350
t.start()
352351
t.join()
353352

354-
355-
def test_main():
356-
support.run_unittest(CAPITest, TestPendingCalls, Test6012,
357-
EmbeddingTest, SkipitemTest, TestThreadState)
358-
359-
for name in dir(_testcapi):
360-
if name.startswith('test_'):
361-
test = getattr(_testcapi, name)
362-
if support.verbose:
363-
print("internal", name)
364-
test()
353+
class Test_testcapi(unittest.TestCase):
354+
def test__testcapi(self):
355+
for name in dir(_testcapi):
356+
if name.startswith('test_'):
357+
test = getattr(_testcapi, name)
358+
test()
365359

366360
if __name__ == "__main__":
367-
test_main()
361+
unittest.main()

Misc/NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ Library
4242
Tests
4343
-----
4444

45+
- Issue #19440: Clean up test_capi by removing an unnecessary __future__
46+
import, converting from test_main to unittest.main, and running the
47+
_testcapi module tests within a unittest TestCase.
48+
4549
- Issue #18702: All skipped tests now reported as skipped.
4650

4751
- Issue #19085: Added basic tests for all tkinter widget options.

0 commit comments

Comments
 (0)