diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2009-10-30 21:41:22 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2009-10-30 21:41:22 (GMT) |
commit | 161df94b0db778b53276bc54bdb282dfb47ccdb4 (patch) | |
tree | dc1a45b70cc0e0816cba8f9fa57154810c98bf60 /Lib | |
parent | 3c96858480f7ffc813859c47e478340fafc54c6b (diff) | |
download | cpython-161df94b0db778b53276bc54bdb282dfb47ccdb4.zip cpython-161df94b0db778b53276bc54bdb282dfb47ccdb4.tar.gz cpython-161df94b0db778b53276bc54bdb282dfb47ccdb4.tar.bz2 |
Try to fix transient refleaks in test_pydoc.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_pydoc.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Lib/test/test_pydoc.py b/Lib/test/test_pydoc.py index 0faf4a1..3eeb738 100644 --- a/Lib/test/test_pydoc.py +++ b/Lib/test/test_pydoc.py @@ -9,7 +9,8 @@ import inspect import unittest import test.test_support from contextlib import contextmanager -from test.test_support import TESTFN, forget, rmtree, EnvironmentVarGuard +from test.test_support import ( + TESTFN, forget, rmtree, EnvironmentVarGuard, reap_children) from test import pydoc_mod @@ -178,8 +179,11 @@ def run_pydoc(module_name, *args): output of pydoc. """ cmd = [sys.executable, pydoc.__file__, " ".join(args), module_name] - output = subprocess.Popen(cmd, stdout=subprocess.PIPE).stdout.read() - return output.strip() + try: + output = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0] + return output.strip() + finally: + reap_children() def get_pydoc_html(module): "Returns pydoc generated output as html" |