diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2011-07-15 20:32:25 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2011-07-15 20:32:25 (GMT) |
commit | a6e81a23b36e61f4803cca059d55943f52b17b7f (patch) | |
tree | e340c4f3b0119ca8a799a019458dccbbffe8366f /Lib | |
parent | 707f228b1eb8d2829797524e0aa93922a238ff66 (diff) | |
download | cpython-a6e81a23b36e61f4803cca059d55943f52b17b7f.zip cpython-a6e81a23b36e61f4803cca059d55943f52b17b7f.tar.gz cpython-a6e81a23b36e61f4803cca059d55943f52b17b7f.tar.bz2 |
test_pydoc needs to cleanup after itself
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_pydoc.py | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/Lib/test/test_pydoc.py b/Lib/test/test_pydoc.py index a8f9fbfc..aaa6912 100644 --- a/Lib/test/test_pydoc.py +++ b/Lib/test/test_pydoc.py @@ -15,8 +15,10 @@ import textwrap from io import StringIO from collections import namedtuple from contextlib import contextmanager -from test.support import TESTFN, forget, rmtree, EnvironmentVarGuard, \ - reap_children, captured_output, captured_stdout, unlink +from test.support import ( + TESTFN, forget, rmtree, EnvironmentVarGuard, + reap_children, reap_threads, captured_output, captured_stdout, unlink +) from test import pydoc_mod @@ -205,11 +207,8 @@ def run_pydoc(module_name, *args): output of pydoc. """ cmd = [sys.executable, pydoc.__file__, " ".join(args), module_name] - try: - output = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0] - return output.strip() - finally: - reap_children() + output = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0] + return output.strip() def get_pydoc_html(module): "Returns pydoc generated output as html" @@ -488,13 +487,17 @@ class TestHelper(unittest.TestCase): self.assertEqual(sorted(pydoc.Helper.keywords), sorted(keyword.kwlist)) +@reap_threads def test_main(): - test.support.run_unittest(PydocDocTest, - TestDescriptions, - PydocServerTest, - PydocUrlHandlerTest, - TestHelper, - ) + try: + test.support.run_unittest(PydocDocTest, + TestDescriptions, + PydocServerTest, + PydocUrlHandlerTest, + TestHelper, + ) + finally: + reap_children() if __name__ == "__main__": test_main() |