mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
bpo-40275: Use new test.support helper submodules in tests (GH-21151)
Use new test.support helper submodules in tests: * distutils tests * test_buffer * test_compile * test_filecmp * test_fileinput * test_readline * test_smtpnet * test_structmembers * test_tools
This commit is contained in:
parent
700cfa8c90
commit
847f94f47b
20 changed files with 69 additions and 42 deletions
|
@ -13,7 +13,9 @@ from distutils.archive_util import (check_archive_formats, make_tarball,
|
|||
ARCHIVE_FORMATS)
|
||||
from distutils.spawn import find_executable, spawn
|
||||
from distutils.tests import support
|
||||
from test.support import check_warnings, run_unittest, patch, change_cwd
|
||||
from test.support import run_unittest, patch
|
||||
from test.support.os_helper import change_cwd
|
||||
from test.support.warnings_helper import check_warnings
|
||||
|
||||
try:
|
||||
import grp
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
"""Tests for distutils.command.bdist_msi."""
|
||||
import sys
|
||||
import unittest
|
||||
from test.support import run_unittest, check_warnings
|
||||
from test.support import run_unittest
|
||||
from test.support.warnings_helper import check_warnings
|
||||
from distutils.tests import support
|
||||
|
||||
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
import sys
|
||||
import platform
|
||||
import unittest
|
||||
from test.support import run_unittest, check_warnings
|
||||
from test.support import run_unittest
|
||||
from test.support.warnings_helper import check_warnings
|
||||
|
||||
from distutils.command.bdist_wininst import bdist_wininst
|
||||
from distutils.tests import support
|
||||
|
|
|
@ -5,8 +5,8 @@ import distutils.core
|
|||
import os
|
||||
import shutil
|
||||
import sys
|
||||
import test.support
|
||||
from test.support import captured_stdout, run_unittest
|
||||
from test.support import os_helper
|
||||
import unittest
|
||||
from distutils.tests import support
|
||||
from distutils import log
|
||||
|
@ -62,13 +62,13 @@ class CoreTestCase(support.EnvironGuard, unittest.TestCase):
|
|||
super(CoreTestCase, self).tearDown()
|
||||
|
||||
def cleanup_testfn(self):
|
||||
path = test.support.TESTFN
|
||||
path = os_helper.TESTFN
|
||||
if os.path.isfile(path):
|
||||
os.remove(path)
|
||||
elif os.path.isdir(path):
|
||||
shutil.rmtree(path)
|
||||
|
||||
def write_setup(self, text, path=test.support.TESTFN):
|
||||
def write_setup(self, text, path=os_helper.TESTFN):
|
||||
f = open(path, "w")
|
||||
try:
|
||||
f.write(text)
|
||||
|
@ -105,8 +105,8 @@ class CoreTestCase(support.EnvironGuard, unittest.TestCase):
|
|||
cwd = os.getcwd()
|
||||
|
||||
# Create a directory and write the setup.py file there:
|
||||
os.mkdir(test.support.TESTFN)
|
||||
setup_py = os.path.join(test.support.TESTFN, "setup.py")
|
||||
os.mkdir(os_helper.TESTFN)
|
||||
setup_py = os.path.join(os_helper.TESTFN, "setup.py")
|
||||
distutils.core.run_setup(
|
||||
self.write_setup(setup_prints_cwd, path=setup_py))
|
||||
|
||||
|
|
|
@ -12,8 +12,9 @@ from distutils.dist import Distribution, fix_help_options
|
|||
from distutils.cmd import Command
|
||||
|
||||
from test.support import (
|
||||
TESTFN, captured_stdout, captured_stderr, run_unittest
|
||||
captured_stdout, captured_stderr, run_unittest
|
||||
)
|
||||
from test.support.os_helper import TESTFN
|
||||
from distutils.tests import support
|
||||
from distutils import log
|
||||
|
||||
|
|
|
@ -3,7 +3,8 @@ import unittest
|
|||
import os
|
||||
import warnings
|
||||
|
||||
from test.support import check_warnings, run_unittest
|
||||
from test.support import run_unittest
|
||||
from test.support.warnings_helper import check_warnings
|
||||
from distutils.extension import read_setup_file, Extension
|
||||
|
||||
class ExtensionTestCase(unittest.TestCase):
|
||||
|
|
|
@ -8,7 +8,9 @@ from distutils.file_util import move_file, copy_file
|
|||
from distutils import log
|
||||
from distutils.tests import support
|
||||
from distutils.errors import DistutilsFileError
|
||||
from test.support import run_unittest, unlink
|
||||
from test.support import run_unittest
|
||||
from test.support.os_helper import unlink
|
||||
|
||||
|
||||
class FileUtilTestCase(support.TempdirManager, unittest.TestCase):
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ from distutils.filelist import glob_to_re, translate_pattern, FileList
|
|||
from distutils import filelist
|
||||
|
||||
import test.support
|
||||
from test.support import os_helper
|
||||
from test.support import captured_stdout, run_unittest
|
||||
from distutils.tests import support
|
||||
|
||||
|
@ -295,7 +296,7 @@ class FileListTestCase(support.LoggingSilencer,
|
|||
|
||||
|
||||
class FindAllTestCase(unittest.TestCase):
|
||||
@test.support.skip_unless_symlink
|
||||
@os_helper.skip_unless_symlink
|
||||
def test_missing_symlink(self):
|
||||
with test.support.temp_cwd():
|
||||
os.symlink('foo', 'bar')
|
||||
|
|
|
@ -5,7 +5,8 @@ import getpass
|
|||
import urllib
|
||||
import warnings
|
||||
|
||||
from test.support import check_warnings, run_unittest
|
||||
from test.support import run_unittest
|
||||
from test.support.warnings_helper import check_warnings
|
||||
|
||||
from distutils.command import register as register_module
|
||||
from distutils.command.register import register
|
||||
|
|
|
@ -6,7 +6,8 @@ import warnings
|
|||
import zipfile
|
||||
from os.path import join
|
||||
from textwrap import dedent
|
||||
from test.support import captured_stdout, check_warnings, run_unittest
|
||||
from test.support import captured_stdout, run_unittest
|
||||
from test.support.warnings_helper import check_warnings
|
||||
|
||||
try:
|
||||
import zlib
|
||||
|
|
|
@ -10,7 +10,10 @@ import unittest
|
|||
from distutils import sysconfig
|
||||
from distutils.ccompiler import get_default_compiler
|
||||
from distutils.tests import support
|
||||
from test.support import TESTFN, run_unittest, check_warnings, swap_item
|
||||
from test.support import run_unittest, swap_item
|
||||
from test.support.os_helper import TESTFN
|
||||
from test.support.warnings_helper import check_warnings
|
||||
|
||||
|
||||
class SysconfigTestCase(support.EnvironGuard, unittest.TestCase):
|
||||
def setUp(self):
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
"""Tests for distutils.unixccompiler."""
|
||||
import sys
|
||||
import unittest
|
||||
from test.support import EnvironmentVarGuard, run_unittest
|
||||
from test.support import run_unittest
|
||||
from test.support.os_helper import EnvironmentVarGuard
|
||||
|
||||
from distutils import sysconfig
|
||||
from distutils.unixccompiler import UnixCCompiler
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue