From 1292aa6db5bed889a3c87df443754fcae0177801 Mon Sep 17 00:00:00 2001 From: Nikita Sobolev Date: Tue, 18 Jan 2022 22:28:18 +0300 Subject: [PATCH] bpo-46425: Fix direct invocation of multiple test modules (GH-30666) --- Lib/test/test_compileall.py | 6 ++---- Lib/test/test_distutils.py | 2 +- Lib/test/test_dtrace.py | 2 +- Lib/test/test_tools/test_freeze.py | 2 +- Lib/test/test_zipfile64.py | 3 ++- Lib/unittest/test/test_program.py | 2 +- 6 files changed, 8 insertions(+), 9 deletions(-) diff --git a/Lib/test/test_compileall.py b/Lib/test/test_compileall.py index 9e15ecf3aae..33f0c939325 100644 --- a/Lib/test/test_compileall.py +++ b/Lib/test/test_compileall.py @@ -3,7 +3,6 @@ import filecmp import importlib.util import io -import itertools import os import pathlib import py_compile @@ -29,9 +28,8 @@ from test import support from test.support import os_helper from test.support import script_helper - -from .test_py_compile import without_source_date_epoch -from .test_py_compile import SourceDateEpochTestMeta +from test.test_py_compile import without_source_date_epoch +from test.test_py_compile import SourceDateEpochTestMeta def get_pyc(script, opt): diff --git a/Lib/test/test_distutils.py b/Lib/test/test_distutils.py index 4b40af02132..d82d2b64234 100644 --- a/Lib/test/test_distutils.py +++ b/Lib/test/test_distutils.py @@ -5,7 +5,7 @@ be run. """ -import warnings +import unittest from test import support from test.support import warnings_helper diff --git a/Lib/test/test_dtrace.py b/Lib/test/test_dtrace.py index 3957077f5d6..8a436ad123b 100644 --- a/Lib/test/test_dtrace.py +++ b/Lib/test/test_dtrace.py @@ -170,4 +170,4 @@ class SystemTapOptimizedTests(TraceTests, unittest.TestCase): if __name__ == '__main__': - test_main() + unittest.main() diff --git a/Lib/test/test_tools/test_freeze.py b/Lib/test/test_tools/test_freeze.py index 386c35a973b..cca3c47f5ac 100644 --- a/Lib/test/test_tools/test_freeze.py +++ b/Lib/test/test_tools/test_freeze.py @@ -6,8 +6,8 @@ from test import support from test.support import os_helper +from test.test_tools import imports_under_tool, skip_if_missing -from . import imports_under_tool, skip_if_missing skip_if_missing('freeze') with imports_under_tool('freeze', 'test'): import freeze as helper diff --git a/Lib/test/test_zipfile64.py b/Lib/test/test_zipfile64.py index 810fdedef39..0947013afbc 100644 --- a/Lib/test/test_zipfile64.py +++ b/Lib/test/test_zipfile64.py @@ -18,8 +18,9 @@ from tempfile import TemporaryFile from test.support import os_helper -from test.support import TESTFN, requires_zlib +from test.support import requires_zlib +TESTFN = os_helper.TESTFN TESTFN2 = TESTFN + "2" # How much time in seconds can pass before we print a 'Still working' message. diff --git a/Lib/unittest/test/test_program.py b/Lib/unittest/test/test_program.py index f7049fbb24e..687f6299674 100644 --- a/Lib/unittest/test/test_program.py +++ b/Lib/unittest/test/test_program.py @@ -6,7 +6,7 @@ from test import support import unittest import unittest.test -from .test_result import BufferedWriter +from unittest.test.test_result import BufferedWriter class Test_TestProgram(unittest.TestCase):