bpo-40275: Use new test.support helper submodules in tests (GH-21451)

This commit is contained in:
Hai Shi 2020-08-04 00:47:42 +08:00 committed by GitHub
parent a7f5d93bb6
commit bb0424b122
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 324 additions and 278 deletions

View file

@ -23,13 +23,12 @@ import xml.etree.ElementTree
import textwrap
from io import StringIO
from collections import namedtuple
from test.support import os_helper
from test.support.script_helper import assert_python_ok
from test.support import threading_helper
from test.support import (
TESTFN, rmtree,
reap_children, captured_output, captured_stdout,
captured_stderr, unlink, requires_docstrings
)
from test.support import (reap_children, captured_output, captured_stdout,
captured_stderr, requires_docstrings)
from test.support.os_helper import (TESTFN, rmtree, unlink)
from test import pydoc_mod
@ -728,7 +727,7 @@ class PydocDocTest(unittest.TestCase):
self.assertEqual(synopsis, expected)
def test_synopsis_sourceless_empty_doc(self):
with test.support.temp_cwd() as test_dir:
with os_helper.temp_cwd() as test_dir:
init_path = os.path.join(test_dir, 'foomod42.py')
cached_path = importlib.util.cache_from_source(init_path)
with open(init_path, 'w') as fobj:
@ -745,11 +744,11 @@ class PydocDocTest(unittest.TestCase):
('I Am A Doc', '\nHere is my description'))
def test_is_package_when_not_package(self):
with test.support.temp_cwd() as test_dir:
with os_helper.temp_cwd() as test_dir:
self.assertFalse(pydoc.ispackage(test_dir))
def test_is_package_when_is_package(self):
with test.support.temp_cwd() as test_dir:
with os_helper.temp_cwd() as test_dir:
init_path = os.path.join(test_dir, '__init__.py')
open(init_path, 'w').close()
self.assertTrue(pydoc.ispackage(test_dir))