diff --git a/Lib/test/test_asyncio/test_events.py b/Lib/test/test_asyncio/test_events.py index 35069608d8163a..ead22999bfeac1 100644 --- a/Lib/test/test_asyncio/test_events.py +++ b/Lib/test/test_asyncio/test_events.py @@ -22,7 +22,6 @@ import unittest from unittest import mock import weakref -import warnings if sys.platform not in ('win32', 'vxworks'): import tty @@ -36,7 +35,6 @@ from test.support import socket_helper from test.support import threading_helper from test.support import ALWAYS_EQ, LARGEST, SMALLEST -from test.support import warnings_helper def tearDownModule(): asyncio._set_event_loop_policy(None) diff --git a/Lib/test/test_asyncio/test_streams.py b/Lib/test/test_asyncio/test_streams.py index 673c6b46c647f3..0b47b2b91a1fe5 100644 --- a/Lib/test/test_asyncio/test_streams.py +++ b/Lib/test/test_asyncio/test_streams.py @@ -1,15 +1,12 @@ """Tests for streams.py.""" import gc -import os import queue import pickle import socket -import sys import threading import unittest from unittest import mock -import warnings try: import ssl except ImportError: @@ -17,7 +14,7 @@ import asyncio from test.test_asyncio import utils as test_utils -from test.support import requires_subprocess, socket_helper +from test.support import socket_helper def tearDownModule(): diff --git a/Lib/test/test_asyncio/test_unix_events.py b/Lib/test/test_asyncio/test_unix_events.py index ebb4cc0f7b64fd..7f9f5a1abbcd99 100644 --- a/Lib/test/test_asyncio/test_unix_events.py +++ b/Lib/test/test_asyncio/test_unix_events.py @@ -10,11 +10,9 @@ import socket import stat import sys -import threading import time import unittest from unittest import mock -import warnings from test import support from test.support import os_helper @@ -27,7 +25,6 @@ import asyncio -from asyncio import log from asyncio import unix_events from test.test_asyncio import utils as test_utils diff --git a/Lib/test/test_asyncio/utils.py b/Lib/test/test_asyncio/utils.py index 35ce13896da08f..c61105712d3cff 100644 --- a/Lib/test/test_asyncio/utils.py +++ b/Lib/test/test_asyncio/utils.py @@ -14,7 +14,6 @@ import threading import unittest import weakref -import warnings from ast import literal_eval from unittest import mock diff --git a/Lib/test/test_builtin.py b/Lib/test/test_builtin.py index 0d4b42eb2ab7be..a0bb6855c8fa3c 100644 --- a/Lib/test/test_builtin.py +++ b/Lib/test/test_builtin.py @@ -16,7 +16,6 @@ import random import re import sys -import textwrap import traceback import types import typing diff --git a/Lib/test/test_bytes.py b/Lib/test/test_bytes.py index d5490a20a0525d..115899d9f3d2b8 100644 --- a/Lib/test/test_bytes.py +++ b/Lib/test/test_bytes.py @@ -11,7 +11,6 @@ import copy import functools import pickle -import sysconfig import tempfile import textwrap import threading diff --git a/Lib/test/test_call.py b/Lib/test/test_call.py index f1b6c55999ebe0..376e7a4bc4da04 100644 --- a/Lib/test/test_call.py +++ b/Lib/test/test_call.py @@ -1,6 +1,6 @@ import unittest from test.support import (cpython_only, is_wasi, requires_limited_api, Py_DEBUG, - set_recursion_limit, skip_on_s390x, exceeds_recursion_limit, skip_emscripten_stack_overflow, skip_wasi_stack_overflow, + set_recursion_limit, skip_on_s390x, skip_emscripten_stack_overflow, skip_wasi_stack_overflow, skip_if_sanitizer, import_helper) try: import _testcapi diff --git a/Lib/test/test_capi/test_config.py b/Lib/test/test_capi/test_config.py index a3179efe4a8235..8dde2ac1e00d89 100644 --- a/Lib/test/test_capi/test_config.py +++ b/Lib/test/test_capi/test_config.py @@ -1,7 +1,6 @@ """ Tests PyConfig_Get() and PyConfig_Set() C API (PEP 741). """ -import os import sys import sysconfig import types diff --git a/Lib/test/test_capi/test_file.py b/Lib/test/test_capi/test_file.py index b5767756992861..1a55c761054e44 100644 --- a/Lib/test/test_capi/test_file.py +++ b/Lib/test/test_capi/test_file.py @@ -1,7 +1,6 @@ import io import os import unittest -import warnings from test import support from test.support import import_helper, os_helper, warnings_helper diff --git a/Lib/test/test_capi/test_getargs.py b/Lib/test/test_capi/test_getargs.py index 703d228f92e713..2fdbe964ddde9d 100644 --- a/Lib/test/test_capi/test_getargs.py +++ b/Lib/test/test_capi/test_getargs.py @@ -1,5 +1,4 @@ import unittest -import math import string import sys from test import support diff --git a/Lib/test/test_capi/test_number.py b/Lib/test/test_capi/test_number.py index b915dee37c7ca6..8e7070307d670f 100644 --- a/Lib/test/test_capi/test_number.py +++ b/Lib/test/test_capi/test_number.py @@ -1,10 +1,9 @@ import itertools import operator -import sys import unittest import warnings -from test.support import cpython_only, import_helper +from test.support import import_helper _testcapi = import_helper.import_module('_testcapi') from _testcapi import PY_SSIZE_T_MAX, PY_SSIZE_T_MIN diff --git a/Lib/test/test_dynamic.py b/Lib/test/test_dynamic.py index 19e779c46a2e84..bddfbb5d902828 100644 --- a/Lib/test/test_dynamic.py +++ b/Lib/test/test_dynamic.py @@ -4,7 +4,7 @@ import sys import unittest -from test.support import swap_item, swap_attr, skip_wasi_stack_overflow, Py_DEBUG +from test.support import swap_item, swap_attr, skip_wasi_stack_overflow class RebindBuiltinsTests(unittest.TestCase): diff --git a/Lib/test/test_embed.py b/Lib/test/test_embed.py index de54d06f305c20..fdece755a740de 100644 --- a/Lib/test/test_embed.py +++ b/Lib/test/test_embed.py @@ -1,12 +1,10 @@ # Run the tests in Programs/_testembed.c (tests for the CPython embedding APIs) from test import support -from test.libregrtest.utils import get_build_info from test.support import import_helper, os_helper, threading_helper, MS_WINDOWS import unittest from collections import namedtuple import contextlib -import io import json import os import os.path diff --git a/Lib/test/test_pkgutil.py b/Lib/test/test_pkgutil.py index 736b83711def03..d4faaaeca00457 100644 --- a/Lib/test/test_pkgutil.py +++ b/Lib/test/test_pkgutil.py @@ -1,6 +1,6 @@ from pathlib import Path -from test.support.import_helper import unload, CleanImport -from test.support.warnings_helper import check_warnings, ignore_warnings +from test.support.import_helper import unload +from test.support.warnings_helper import check_warnings import unittest import sys import importlib diff --git a/Lib/test/test_pyrepl/support.py b/Lib/test/test_pyrepl/support.py index 45e3bf758f17de..db7c68681f62c4 100644 --- a/Lib/test/test_pyrepl/support.py +++ b/Lib/test/test_pyrepl/support.py @@ -1,4 +1,3 @@ -import os from code import InteractiveConsole from functools import partial from typing import Iterable diff --git a/Lib/test/test_pyrepl/test_eventqueue.py b/Lib/test/test_pyrepl/test_eventqueue.py index b25bdb956b0d14..afb557103424a6 100644 --- a/Lib/test/test_pyrepl/test_eventqueue.py +++ b/Lib/test/test_pyrepl/test_eventqueue.py @@ -1,6 +1,5 @@ import tempfile import unittest -import sys from unittest.mock import patch from test import support diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py index 078ddd6c431b37..2eb440933271e5 100644 --- a/Lib/test/test_shutil.py +++ b/Lib/test/test_shutil.py @@ -10,7 +10,6 @@ import os.path import errno import functools -import pathlib import subprocess import random import string diff --git a/Lib/test/test_tarfile.py b/Lib/test/test_tarfile.py index 54d329a15d4d25..3e4cf8dd56db08 100644 --- a/Lib/test/test_tarfile.py +++ b/Lib/test/test_tarfile.py @@ -19,7 +19,6 @@ from test import support from test.support import os_helper from test.support import script_helper -from test.support import warnings_helper # Check for our compression modules. try: diff --git a/Lib/test/test_thread_local_bytecode.py b/Lib/test/test_thread_local_bytecode.py index ea52fb888ce25d..d5c56db8d5da58 100644 --- a/Lib/test/test_thread_local_bytecode.py +++ b/Lib/test/test_thread_local_bytecode.py @@ -1,5 +1,4 @@ """Tests for thread-local bytecode.""" -import dis import textwrap import unittest diff --git a/Lib/test/test_types.py b/Lib/test/test_types.py index 5a65b5dacaf581..10d250e01d88e6 100644 --- a/Lib/test/test_types.py +++ b/Lib/test/test_types.py @@ -1,9 +1,7 @@ # Python test set -- part 6, built-in types from test.support import ( - run_with_locale, is_apple_mobile, cpython_only, no_rerun, - iter_builtin_types, iter_slot_wrappers, - MISSING_C_DOCSTRINGS, + run_with_locale, cpython_only, no_rerun, MISSING_C_DOCSTRINGS ) import collections.abc from collections import namedtuple, UserDict diff --git a/Lib/test/test_userdict.py b/Lib/test/test_userdict.py index 9bd842eda5b49c..ace84ef564df72 100644 --- a/Lib/test/test_userdict.py +++ b/Lib/test/test_userdict.py @@ -1,6 +1,6 @@ # Check every path through every method of UserDict -from test import mapping_tests, support +from test import mapping_tests import unittest import collections diff --git a/Lib/test/test_userlist.py b/Lib/test/test_userlist.py index e82e88f3f3ed1d..d3d9f4cff8da3a 100644 --- a/Lib/test/test_userlist.py +++ b/Lib/test/test_userlist.py @@ -3,7 +3,6 @@ from collections import UserList from test import list_tests import unittest -from test import support class UserListTest(list_tests.CommonTest): diff --git a/Lib/test/test_zipfile/_path/test_path.py b/Lib/test/test_zipfile/_path/test_path.py index 1ee45f5fc57104..0afabc0c6683c4 100644 --- a/Lib/test/test_zipfile/_path/test_path.py +++ b/Lib/test/test_zipfile/_path/test_path.py @@ -5,7 +5,6 @@ import pickle import stat import sys -import time import unittest import zipfile import zipfile._path diff --git a/Lib/test/test_zipfile/test_core.py b/Lib/test/test_zipfile/test_core.py index 6b1fe56074d561..44e8190ac6710b 100644 --- a/Lib/test/test_zipfile/test_core.py +++ b/Lib/test/test_zipfile/test_core.py @@ -24,7 +24,6 @@ from test.support import ( findfile, requires_zlib, requires_bz2, requires_lzma, captured_stdout, captured_stderr, requires_subprocess, - is_emscripten ) from test.support.os_helper import ( TESTFN, unlink, rmtree, temp_dir, temp_cwd, fd_count, FakePath