mirror of https://github.com/python/cpython.git
test_pydoc needs to cleanup after itself
This commit is contained in:
parent
707f228b1e
commit
a6e81a23b3
|
@ -15,8 +15,10 @@
|
||||||
from io import StringIO
|
from io import StringIO
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
from test.support import TESTFN, forget, rmtree, EnvironmentVarGuard, \
|
from test.support import (
|
||||||
reap_children, captured_output, captured_stdout, unlink
|
TESTFN, forget, rmtree, EnvironmentVarGuard,
|
||||||
|
reap_children, reap_threads, captured_output, captured_stdout, unlink
|
||||||
|
)
|
||||||
|
|
||||||
from test import pydoc_mod
|
from test import pydoc_mod
|
||||||
|
|
||||||
|
@ -205,11 +207,8 @@ def run_pydoc(module_name, *args):
|
||||||
output of pydoc.
|
output of pydoc.
|
||||||
"""
|
"""
|
||||||
cmd = [sys.executable, pydoc.__file__, " ".join(args), module_name]
|
cmd = [sys.executable, pydoc.__file__, " ".join(args), module_name]
|
||||||
try:
|
output = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0]
|
||||||
output = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0]
|
return output.strip()
|
||||||
return output.strip()
|
|
||||||
finally:
|
|
||||||
reap_children()
|
|
||||||
|
|
||||||
def get_pydoc_html(module):
|
def get_pydoc_html(module):
|
||||||
"Returns pydoc generated output as html"
|
"Returns pydoc generated output as html"
|
||||||
|
@ -488,13 +487,17 @@ def test_keywords(self):
|
||||||
self.assertEqual(sorted(pydoc.Helper.keywords),
|
self.assertEqual(sorted(pydoc.Helper.keywords),
|
||||||
sorted(keyword.kwlist))
|
sorted(keyword.kwlist))
|
||||||
|
|
||||||
|
@reap_threads
|
||||||
def test_main():
|
def test_main():
|
||||||
test.support.run_unittest(PydocDocTest,
|
try:
|
||||||
TestDescriptions,
|
test.support.run_unittest(PydocDocTest,
|
||||||
PydocServerTest,
|
TestDescriptions,
|
||||||
PydocUrlHandlerTest,
|
PydocServerTest,
|
||||||
TestHelper,
|
PydocUrlHandlerTest,
|
||||||
)
|
TestHelper,
|
||||||
|
)
|
||||||
|
finally:
|
||||||
|
reap_children()
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
test_main()
|
||||||
|
|
Loading…
Reference in New Issue