[Python-checkins] cpython (merge 3.3 -> default): Issue #19440: Clean up test_capi
zach.ware
python-checkins at python.org
Tue Nov 12 06:00:07 CET 2013
http://hg.python.org/cpython/rev/26108b2761aa
changeset: 87059:26108b2761aa
parent: 87057:45aca50a7f72
parent: 87058:5198e8f325f5
user: Zachary Ware <zachary.ware at gmail.com>
date: Mon Nov 11 22:59:23 2013 -0600
summary:
Issue #19440: Clean up test_capi
files:
Lib/test/test_capi.py | 22 ++++++++--------------
Misc/NEWS | 4 ++++
2 files changed, 12 insertions(+), 14 deletions(-)
diff --git a/Lib/test/test_capi.py b/Lib/test/test_capi.py
--- a/Lib/test/test_capi.py
+++ b/Lib/test/test_capi.py
@@ -1,7 +1,6 @@
# Run the _testcapi module tests (tests for the Python/C API): by defn,
# these are all functions _testcapi exports whose name begins with 'test_'.
-from __future__ import with_statement
import os
import pickle
import random
@@ -416,18 +415,13 @@
t.start()
t.join()
-
-def test_main():
- support.run_unittest(CAPITest, TestPendingCalls, Test6012,
- EmbeddingTests, SkipitemTest, TestThreadState,
- SubinterpreterTest)
-
- for name in dir(_testcapi):
- if name.startswith('test_'):
- test = getattr(_testcapi, name)
- if support.verbose:
- print("internal", name)
- test()
+class Test_testcapi(unittest.TestCase):
+ def test__testcapi(self):
+ for name in dir(_testcapi):
+ if name.startswith('test_'):
+ with self.subTest("internal", name=name):
+ test = getattr(_testcapi, name)
+ test()
if __name__ == "__main__":
- test_main()
+ unittest.main()
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -213,6 +213,10 @@
Tests
-----
+- Issue #19440: Clean up test_capi by removing an unnecessary __future__
+ import, converting from test_main to unittest.main, and running the
+ _testcapi module tests as subTests of a unittest TestCase method.
+
- Issue #19378: the main dis module tests are now run with both stdout
redirection *and* passing an explicit file parameter
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list