[Python-checkins] Revert "Remove unused imports in tests (GH-14518) (GH-14522)" (GH-14555)

Victor Stinner webhook-mailer at python.org
Tue Jul 2 08:42:45 EDT 2019


https://github.com/python/cpython/commit/19b8d903b0dd43dc405c4d6e1c61c3429020545e
commit: 19b8d903b0dd43dc405c4d6e1c61c3429020545e
branch: 3.7
author: Victor Stinner <vstinner at redhat.com>
committer: GitHub <noreply at github.com>
date: 2019-07-02T14:42:39+02:00
summary:

Revert "Remove unused imports in tests (GH-14518) (GH-14522)" (GH-14555)

This reverts commit e34b5f4d6483187969d5149c801d056b72ef2ddb.

files:
M Lib/test/libregrtest/main.py
M Lib/test/support/__init__.py
M Lib/test/test_aifc.py
M Lib/test/test_argparse.py
M Lib/test/test_asynchat.py
M Lib/test/test_asyncio/test_pep492.py
M Lib/test/test_asyncio/test_sslproto.py
M Lib/test/test_asyncio/test_unix_events.py
M Lib/test/test_c_locale_coercion.py
M Lib/test/test_capi.py
M Lib/test/test_cmd_line.py
M Lib/test/test_collections.py
M Lib/test/test_contextlib.py
M Lib/test/test_coroutines.py
M Lib/test/test_docxmlrpc.py
M Lib/test/test_email/test_policy.py
M Lib/test/test_exceptions.py
M Lib/test/test_faulthandler.py
M Lib/test/test_fork1.py
M Lib/test/test_frozen.py
M Lib/test/test_gdb.py
M Lib/test/test_generators.py
M Lib/test/test_gettext.py
M Lib/test/test_grammar.py
M Lib/test/test_imaplib.py
M Lib/test/test_import/__init__.py
M Lib/test/test_importlib/test_locks.py
M Lib/test/test_locale.py
M Lib/test/test_netrc.py
M Lib/test/test_os.py
M Lib/test/test_posixpath.py
M Lib/test/test_pyclbr.py
M Lib/test/test_pydoc.py
M Lib/test/test_queue.py
M Lib/test/test_resource.py
M Lib/test/test_runpy.py
M Lib/test/test_sax.py
M Lib/test/test_signal.py
M Lib/test/test_smtplib.py
M Lib/test/test_subprocess.py
M Lib/test/test_thread.py
M Lib/test/test_threaded_import.py
M Lib/test/test_threadedtempfile.py
M Lib/test/test_time.py
M Lib/test/test_tokenize.py
M Lib/test/test_traceback.py
M Lib/test/test_utf8_mode.py
M Lib/test/test_venv.py

diff --git a/Lib/test/libregrtest/main.py b/Lib/test/libregrtest/main.py
index e2274254fdb8..1dfbe47a2fab 100644
--- a/Lib/test/libregrtest/main.py
+++ b/Lib/test/libregrtest/main.py
@@ -587,6 +587,7 @@ def create_temp_dir(self):
 
     def cleanup(self):
         import glob
+        import shutil
 
         path = os.path.join(self.tmp_dir, 'test_python_*')
         print("Cleanup %s directory" % self.tmp_dir)
diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py
index 6d10e8b576e4..87bfa9f54627 100644
--- a/Lib/test/support/__init__.py
+++ b/Lib/test/support/__init__.py
@@ -5,6 +5,7 @@
 
 import collections.abc
 import contextlib
+import datetime
 import errno
 import faulthandler
 import fnmatch
@@ -12,6 +13,7 @@
 import gc
 import importlib
 import importlib.util
+import io
 import logging.handlers
 import nntplib
 import os
diff --git a/Lib/test/test_aifc.py b/Lib/test/test_aifc.py
index e82cfc1a4690..ff52f5b6feb8 100644
--- a/Lib/test/test_aifc.py
+++ b/Lib/test/test_aifc.py
@@ -7,6 +7,7 @@
 import sys
 import struct
 import aifc
+import warnings
 
 
 class AifcTest(audiotests.AudioWriteTests,
diff --git a/Lib/test/test_argparse.py b/Lib/test/test_argparse.py
index 0c342e2e4e0d..51f0effaf2ff 100644
--- a/Lib/test/test_argparse.py
+++ b/Lib/test/test_argparse.py
@@ -1,5 +1,6 @@
 # Author: Steven J. Bethard <steven.bethard at gmail.com>.
 
+import codecs
 import inspect
 import os
 import shutil
diff --git a/Lib/test/test_asynchat.py b/Lib/test/test_asynchat.py
index 14c0ec43d422..1d147c741961 100644
--- a/Lib/test/test_asynchat.py
+++ b/Lib/test/test_asynchat.py
@@ -7,6 +7,7 @@
 import errno
 import socket
 import sys
+import _thread as thread
 import threading
 import time
 import unittest
diff --git a/Lib/test/test_asyncio/test_pep492.py b/Lib/test/test_asyncio/test_pep492.py
index ac3ae6811fb5..f2d588f54445 100644
--- a/Lib/test/test_asyncio/test_pep492.py
+++ b/Lib/test/test_asyncio/test_pep492.py
@@ -4,6 +4,7 @@
 import types
 import unittest
 
+from test import support
 from unittest import mock
 
 import asyncio
diff --git a/Lib/test/test_asyncio/test_sslproto.py b/Lib/test/test_asyncio/test_sslproto.py
index 3b9c12f24ed3..866ef81fb2ee 100644
--- a/Lib/test/test_asyncio/test_sslproto.py
+++ b/Lib/test/test_asyncio/test_sslproto.py
@@ -15,6 +15,7 @@
 from asyncio import log
 from asyncio import protocols
 from asyncio import sslproto
+from asyncio import tasks
 from test.test_asyncio import utils as test_utils
 from test.test_asyncio import functional as func_tests
 
diff --git a/Lib/test/test_asyncio/test_unix_events.py b/Lib/test/test_asyncio/test_unix_events.py
index 51d474cf152c..ec171fa83da3 100644
--- a/Lib/test/test_asyncio/test_unix_events.py
+++ b/Lib/test/test_asyncio/test_unix_events.py
@@ -22,6 +22,7 @@
 
 import asyncio
 from asyncio import log
+from asyncio import base_events
 from asyncio import events
 from asyncio import unix_events
 from test.test_asyncio import utils as test_utils
diff --git a/Lib/test/test_c_locale_coercion.py b/Lib/test/test_c_locale_coercion.py
index 94391c87995a..0355547436b2 100644
--- a/Lib/test/test_c_locale_coercion.py
+++ b/Lib/test/test_c_locale_coercion.py
@@ -2,6 +2,7 @@
 
 import locale
 import os
+import shutil
 import subprocess
 import sys
 import sysconfig
@@ -9,8 +10,10 @@
 from collections import namedtuple
 
 import test.support
-from test.support.script_helper import run_python_until_end
-
+from test.support.script_helper import (
+    run_python_until_end,
+    interpreter_requires_environment,
+)
 
 # Set the list of ways we expect to be able to ask for the "C" locale
 EXPECTED_C_LOCALE_EQUIVALENTS = ["C", "invalid.ascii"]
diff --git a/Lib/test/test_capi.py b/Lib/test/test_capi.py
index 6eb3bd967b86..d94ee0227c87 100644
--- a/Lib/test/test_capi.py
+++ b/Lib/test/test_capi.py
@@ -8,6 +8,7 @@
 import re
 import subprocess
 import sys
+import sysconfig
 import textwrap
 import threading
 import time
diff --git a/Lib/test/test_cmd_line.py b/Lib/test/test_cmd_line.py
index f90bfb067483..95cdc8db7efb 100644
--- a/Lib/test/test_cmd_line.py
+++ b/Lib/test/test_cmd_line.py
@@ -5,6 +5,7 @@
 import os
 import subprocess
 import sys
+import sysconfig
 import tempfile
 import unittest
 from test import support
diff --git a/Lib/test/test_collections.py b/Lib/test/test_collections.py
index 1aca9facda69..16735b815e53 100644
--- a/Lib/test/test_collections.py
+++ b/Lib/test/test_collections.py
@@ -3,9 +3,11 @@
 import collections
 import copy
 import doctest
+import keyword
 import operator
 import pickle
 from random import choice, randrange
+import re
 import string
 import sys
 from test import support
diff --git a/Lib/test/test_contextlib.py b/Lib/test/test_contextlib.py
index ced2290288db..30c2e27b3c7e 100644
--- a/Lib/test/test_contextlib.py
+++ b/Lib/test/test_contextlib.py
@@ -1,5 +1,6 @@
 """Unit tests for contextlib.py, and other context managers."""
 
+import asyncio
 import io
 import sys
 import tempfile
diff --git a/Lib/test/test_coroutines.py b/Lib/test/test_coroutines.py
index f32320956bcc..ac24f3976738 100644
--- a/Lib/test/test_coroutines.py
+++ b/Lib/test/test_coroutines.py
@@ -2,6 +2,7 @@
 import copy
 import inspect
 import pickle
+import re
 import sys
 import types
 import unittest
diff --git a/Lib/test/test_docxmlrpc.py b/Lib/test/test_docxmlrpc.py
index 116e626740df..f077f05f5b4f 100644
--- a/Lib/test/test_docxmlrpc.py
+++ b/Lib/test/test_docxmlrpc.py
@@ -2,6 +2,7 @@
 import http.client
 import sys
 import threading
+from test import support
 import unittest
 
 def make_request_and_skipIf(condition, reason):
diff --git a/Lib/test/test_email/test_policy.py b/Lib/test/test_email/test_policy.py
index 1e39aa062c0a..0aea934df434 100644
--- a/Lib/test/test_email/test_policy.py
+++ b/Lib/test/test_email/test_policy.py
@@ -1,4 +1,5 @@
 import io
+import sys
 import types
 import textwrap
 import unittest
diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py
index 0196c4d0005b..9d10df5f9425 100644
--- a/Lib/test/test_exceptions.py
+++ b/Lib/test/test_exceptions.py
@@ -9,7 +9,7 @@
 import errno
 
 from test.support import (TESTFN, captured_stderr, check_impl_detail,
-                          check_warnings, cpython_only, gc_collect,
+                          check_warnings, cpython_only, gc_collect, run_unittest,
                           no_tracing, unlink, import_module, script_helper,
                           SuppressCrashReport)
 class NaiveException(Exception):
diff --git a/Lib/test/test_faulthandler.py b/Lib/test/test_faulthandler.py
index 5283596cebe4..700b7ad6b885 100644
--- a/Lib/test/test_faulthandler.py
+++ b/Lib/test/test_faulthandler.py
@@ -9,6 +9,7 @@
 from test import support
 from test.support import script_helper, is_android
 import tempfile
+import threading
 import unittest
 from textwrap import dedent
 
diff --git a/Lib/test/test_fork1.py b/Lib/test/test_fork1.py
index 2ab856ff5690..9ca9724c4c91 100644
--- a/Lib/test/test_fork1.py
+++ b/Lib/test/test_fork1.py
@@ -10,7 +10,8 @@
 import unittest
 
 from test.fork_wait import ForkWait
-from test.support import reap_children, get_attribute, verbose
+from test.support import (reap_children, get_attribute,
+                          import_module, verbose)
 
 
 # Skip test if fork does not exist.
diff --git a/Lib/test/test_frozen.py b/Lib/test/test_frozen.py
index 142f17d518e7..a7c748422b1d 100644
--- a/Lib/test/test_frozen.py
+++ b/Lib/test/test_frozen.py
@@ -13,6 +13,7 @@
 import sys
 import unittest
 from test.support import captured_stdout
+from importlib import util
 
 
 class TestFrozen(unittest.TestCase):
diff --git a/Lib/test/test_gdb.py b/Lib/test/test_gdb.py
index b78c0845b1df..7758e1fcd86c 100644
--- a/Lib/test/test_gdb.py
+++ b/Lib/test/test_gdb.py
@@ -3,6 +3,7 @@
 # The code for testing gdb was adapted from similar work in Unladen Swallow's
 # Lib/test/test_jit_gdb.py
 
+import locale
 import os
 import platform
 import re
diff --git a/Lib/test/test_generators.py b/Lib/test/test_generators.py
index c45086562d36..7a21cb7e954a 100644
--- a/Lib/test/test_generators.py
+++ b/Lib/test/test_generators.py
@@ -3,6 +3,7 @@
 import pickle
 import sys
 import unittest
+import warnings
 import weakref
 import inspect
 
diff --git a/Lib/test/test_gettext.py b/Lib/test/test_gettext.py
index fac38000e635..b5ed05eab7bb 100644
--- a/Lib/test/test_gettext.py
+++ b/Lib/test/test_gettext.py
@@ -1,6 +1,7 @@
 import os
 import base64
 import gettext
+import locale
 import unittest
 
 from test import support
diff --git a/Lib/test/test_grammar.py b/Lib/test/test_grammar.py
index 241ac853d73c..88c22b89d444 100644
--- a/Lib/test/test_grammar.py
+++ b/Lib/test/test_grammar.py
@@ -4,6 +4,7 @@
 from test.support import check_syntax_error
 import inspect
 import unittest
+import sys
 # testing import *
 from sys import *
 
@@ -11,6 +12,7 @@
 # with import machinery
 import test.ann_module as ann_module
 import typing
+from collections import ChainMap
 from test import ann_module2
 import test
 
diff --git a/Lib/test/test_imaplib.py b/Lib/test/test_imaplib.py
index 8ab532af3f0d..9305e47ee993 100644
--- a/Lib/test/test_imaplib.py
+++ b/Lib/test/test_imaplib.py
@@ -1,6 +1,7 @@
 from test import support
 
 from contextlib import contextmanager
+import errno
 import imaplib
 import os.path
 import socketserver
diff --git a/Lib/test/test_import/__init__.py b/Lib/test/test_import/__init__.py
index 4c4f0d9efc03..1fc4de11e178 100644
--- a/Lib/test/test_import/__init__.py
+++ b/Lib/test/test_import/__init__.py
@@ -5,6 +5,7 @@
 import builtins
 import marshal
 import os
+import platform
 import py_compile
 import random
 import stat
@@ -19,9 +20,9 @@
 
 import test.support
 from test.support import (
-    TESTFN, forget, is_jython,
-    make_legacy_pyc, rmtree, swap_attr, swap_item, temp_umask,
-    unlink, unload, cpython_only, TESTFN_UNENCODABLE,
+    EnvironmentVarGuard, TESTFN, check_warnings, forget, is_jython,
+    make_legacy_pyc, rmtree, run_unittest, swap_attr, swap_item, temp_umask,
+    unlink, unload, create_empty_file, cpython_only, TESTFN_UNENCODABLE,
     temp_dir, DirsOnSysPath)
 from test.support import script_helper
 from test.test_importlib.util import uncache
diff --git a/Lib/test/test_importlib/test_locks.py b/Lib/test/test_importlib/test_locks.py
index 21794d911ef6..d86172ab5837 100644
--- a/Lib/test/test_importlib/test_locks.py
+++ b/Lib/test/test_importlib/test_locks.py
@@ -4,6 +4,7 @@
 
 import sys
 import threading
+import unittest
 import weakref
 
 from test import support
diff --git a/Lib/test/test_locale.py b/Lib/test/test_locale.py
index 792a15c50f92..e2c2178ae6cc 100644
--- a/Lib/test/test_locale.py
+++ b/Lib/test/test_locale.py
@@ -3,7 +3,7 @@
 import locale
 import sys
 import codecs
-
+import warnings
 
 class BaseLocalizedTest(unittest.TestCase):
     #
diff --git a/Lib/test/test_netrc.py b/Lib/test/test_netrc.py
index ae53988c45a6..f59e5371acad 100644
--- a/Lib/test/test_netrc.py
+++ b/Lib/test/test_netrc.py
@@ -1,4 +1,5 @@
 import netrc, os, unittest, sys, tempfile, textwrap
+from unittest import mock
 from test import support
 
 
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py
index 1ec9a6a95091..8032da053067 100644
--- a/Lib/test/test_os.py
+++ b/Lib/test/test_os.py
@@ -9,6 +9,7 @@
 import decimal
 import errno
 import fractions
+import getpass
 import itertools
 import locale
 import mmap
diff --git a/Lib/test/test_posixpath.py b/Lib/test/test_posixpath.py
index 6bca89003a97..e73b31cb648b 100644
--- a/Lib/test/test_posixpath.py
+++ b/Lib/test/test_posixpath.py
@@ -1,6 +1,7 @@
 import os
 import posixpath
 import unittest
+import warnings
 from posixpath import realpath, abspath, dirname, basename
 from test import support, test_genericpath
 from test.support import FakePath
@@ -11,7 +12,6 @@
 except ImportError:
     posix = None
 
-
 # An absolute path to a temporary filename for testing. We can't rely on TESTFN
 # being an absolute path, so we need this.
 
diff --git a/Lib/test/test_pyclbr.py b/Lib/test/test_pyclbr.py
index 0489b41d7c7b..eaab591f74ef 100644
--- a/Lib/test/test_pyclbr.py
+++ b/Lib/test/test_pyclbr.py
@@ -3,11 +3,14 @@
    Nick Mathewson
 '''
 
+import os
 import sys
 from textwrap import dedent
 from types import FunctionType, MethodType, BuiltinFunctionType
 import pyclbr
 from unittest import TestCase, main as unittest_main
+from test import support
+from functools import partial
 
 StaticMethodType = type(staticmethod(lambda: None))
 ClassMethodType = type(classmethod(lambda c: None))
diff --git a/Lib/test/test_pydoc.py b/Lib/test/test_pydoc.py
index 8e30b4c8f675..198cea93eb52 100644
--- a/Lib/test/test_pydoc.py
+++ b/Lib/test/test_pydoc.py
@@ -21,6 +21,7 @@
 import xml.etree
 import xml.etree.ElementTree
 import textwrap
+import threading
 from io import StringIO
 from collections import namedtuple
 from test.support.script_helper import assert_python_ok
diff --git a/Lib/test/test_queue.py b/Lib/test/test_queue.py
index c8528f97741d..1a8d5f8856c5 100644
--- a/Lib/test/test_queue.py
+++ b/Lib/test/test_queue.py
@@ -1,8 +1,10 @@
 # Some simple queue module tests, plus some failure conditions
 # to ensure the Queue locks remain stable.
+import collections
 import itertools
 import queue
 import random
+import sys
 import threading
 import time
 import unittest
diff --git a/Lib/test/test_resource.py b/Lib/test/test_resource.py
index 62c7963fe699..b07eb73b2aeb 100644
--- a/Lib/test/test_resource.py
+++ b/Lib/test/test_resource.py
@@ -1,5 +1,6 @@
 import contextlib
 import sys
+import os
 import unittest
 from test import support
 import time
diff --git a/Lib/test/test_runpy.py b/Lib/test/test_runpy.py
index 0da6f3a60430..02b4d62567e5 100644
--- a/Lib/test/test_runpy.py
+++ b/Lib/test/test_runpy.py
@@ -11,7 +11,8 @@
 from test.support import (
     forget, make_legacy_pyc, unload, verbose, no_tracing,
     create_empty_file, temp_dir)
-from test.support.script_helper import make_script, make_zip_script
+from test.support.script_helper import (
+    make_pkg, make_script, make_zip_pkg, make_zip_script)
 
 
 import runpy
diff --git a/Lib/test/test_sax.py b/Lib/test/test_sax.py
index 251a03a54ddc..3044960a0ed1 100644
--- a/Lib/test/test_sax.py
+++ b/Lib/test/test_sax.py
@@ -17,6 +17,7 @@
 from xml.sax.xmlreader import InputSource, AttributesImpl, AttributesNSImpl
 from io import BytesIO, StringIO
 import codecs
+import gc
 import os.path
 import shutil
 from urllib.error import URLError
diff --git a/Lib/test/test_signal.py b/Lib/test/test_signal.py
index c3f5b148448c..406684bdbec7 100644
--- a/Lib/test/test_signal.py
+++ b/Lib/test/test_signal.py
@@ -5,6 +5,7 @@
 import statistics
 import subprocess
 import sys
+import threading
 import time
 import unittest
 from test import support
diff --git a/Lib/test/test_smtplib.py b/Lib/test/test_smtplib.py
index 4add8fcabfd1..b4149d3ef007 100644
--- a/Lib/test/test_smtplib.py
+++ b/Lib/test/test_smtplib.py
@@ -19,7 +19,7 @@
 
 import unittest
 from test import support, mock_socket
-from test.support import HOST
+from test.support import HOST, HOSTv4, HOSTv6
 from unittest.mock import Mock
 
 
diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py
index 36cf22a9f898..8419061b2a90 100644
--- a/Lib/test/test_subprocess.py
+++ b/Lib/test/test_subprocess.py
@@ -3,6 +3,7 @@
 from test import support
 import subprocess
 import sys
+import platform
 import signal
 import io
 import itertools
@@ -19,12 +20,18 @@
 import textwrap
 from test.support import FakePath
 
+try:
+    import ctypes
+except ImportError:
+    ctypes = None
+else:
+    import ctypes.util
+
 try:
     import _testcapi
 except ImportError:
     _testcapi = None
 
-
 if support.PGO:
     raise unittest.SkipTest("test is not helpful for PGO")
 
diff --git a/Lib/test/test_thread.py b/Lib/test/test_thread.py
index f4eb830cf6d7..64ffe4605298 100644
--- a/Lib/test/test_thread.py
+++ b/Lib/test/test_thread.py
@@ -4,6 +4,7 @@
 from test import support
 import _thread as thread
 import time
+import sys
 import weakref
 
 from test import lock_tests
diff --git a/Lib/test/test_threaded_import.py b/Lib/test/test_threaded_import.py
index 8607f363db21..035344be4b89 100644
--- a/Lib/test/test_threaded_import.py
+++ b/Lib/test/test_threaded_import.py
@@ -15,7 +15,7 @@
 import unittest
 from unittest import mock
 from test.support import (
-    verbose, run_unittest, TESTFN, reap_threads,
+    verbose, import_module, run_unittest, TESTFN, reap_threads,
     forget, unlink, rmtree, start_threads)
 
 def task(N, done, done_tasks, errors):
diff --git a/Lib/test/test_threadedtempfile.py b/Lib/test/test_threadedtempfile.py
index e1d7a10179cc..f3d4ba36377d 100644
--- a/Lib/test/test_threadedtempfile.py
+++ b/Lib/test/test_threadedtempfile.py
@@ -13,22 +13,19 @@
 provoking a 2.0 failure under Linux.
 """
 
+NUM_THREADS = 20
+FILES_PER_THREAD = 50
+
 import tempfile
 
-from test.support import start_threads
+from test.support import start_threads, import_module
 import unittest
 import io
 import threading
 from traceback import print_exc
 
-
-NUM_THREADS = 20
-FILES_PER_THREAD = 50
-
-
 startEvent = threading.Event()
 
-
 class TempFileGreedy(threading.Thread):
     error_count = 0
     ok_count = 0
diff --git a/Lib/test/test_time.py b/Lib/test/test_time.py
index 35952799ba6d..4e31abf4ec8e 100644
--- a/Lib/test/test_time.py
+++ b/Lib/test/test_time.py
@@ -9,6 +9,7 @@
 import time
 import threading
 import unittest
+import warnings
 try:
     import _testcapi
 except ImportError:
diff --git a/Lib/test/test_tokenize.py b/Lib/test/test_tokenize.py
index 7457a7ed0434..d596f7db61ab 100644
--- a/Lib/test/test_tokenize.py
+++ b/Lib/test/test_tokenize.py
@@ -1,7 +1,7 @@
 from test import support
 from tokenize import (tokenize, _tokenize, untokenize, NUMBER, NAME, OP,
                      STRING, ENDMARKER, ENCODING, tok_name, detect_encoding,
-                     open as tokenize_open, Untokenizer,
+                     open as tokenize_open, Untokenizer, generate_tokens,
                      NEWLINE)
 from io import BytesIO
 import unittest
diff --git a/Lib/test/test_traceback.py b/Lib/test/test_traceback.py
index 8749d095ddee..8a3aa8a8648f 100644
--- a/Lib/test/test_traceback.py
+++ b/Lib/test/test_traceback.py
@@ -110,7 +110,7 @@ def test_encoded_file(self):
         # Test that tracebacks are correctly printed for encoded source files:
         # - correct line number (Issue2384)
         # - respect file encoding (Issue3975)
-        import sys, subprocess
+        import tempfile, sys, subprocess, os
 
         # The spawned subprocess has its stdout redirected to a PIPE, and its
         # encoding may be different from the current interpreter, on Windows
diff --git a/Lib/test/test_utf8_mode.py b/Lib/test/test_utf8_mode.py
index a7d1dc940ad6..06fe1979ddcc 100644
--- a/Lib/test/test_utf8_mode.py
+++ b/Lib/test/test_utf8_mode.py
@@ -3,6 +3,7 @@
 """
 
 import locale
+import os
 import sys
 import textwrap
 import unittest
diff --git a/Lib/test/test_venv.py b/Lib/test/test_venv.py
index 3821d9accfdf..67f9f46e65e0 100644
--- a/Lib/test/test_venv.py
+++ b/Lib/test/test_venv.py
@@ -15,6 +15,7 @@
 import tempfile
 from test.support import (captured_stdout, captured_stderr, requires_zlib,
                           can_symlink, EnvironmentVarGuard, rmtree)
+import threading
 import unittest
 import venv
 



More information about the Python-checkins mailing list