mirror of https://github.com/python/cpython
gh-84623: Remove unused imports in tests (#93772)
This commit is contained in:
parent
65ff27c7d3
commit
3ceb4b8d3a
|
@ -1,5 +1,4 @@
|
|||
"""Tests for distutils.command.bdist."""
|
||||
import os
|
||||
import unittest
|
||||
from test.support import run_unittest
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@ from distutils.ccompiler import get_default_compiler
|
|||
from distutils.tests import support
|
||||
from test.support import run_unittest, swap_item, requires_subprocess, is_wasi
|
||||
from test.support.os_helper import TESTFN
|
||||
from test.support.warnings_helper import check_warnings
|
||||
|
||||
|
||||
class SysconfigTestCase(support.EnvironGuard, unittest.TestCase):
|
||||
|
|
|
@ -7,7 +7,6 @@ running time.
|
|||
|
||||
# Python imports
|
||||
import os.path
|
||||
import sys
|
||||
import test.support
|
||||
import unittest
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@ import itertools
|
|||
import bisect
|
||||
import copy
|
||||
import decimal
|
||||
import functools
|
||||
import sys
|
||||
import os
|
||||
import pickle
|
||||
|
|
|
@ -141,7 +141,7 @@ def _adjust_resource_limits():
|
|||
"""Adjust the system resource limits (ulimit) if needed."""
|
||||
try:
|
||||
import resource
|
||||
from resource import RLIMIT_NOFILE, RLIM_INFINITY
|
||||
from resource import RLIMIT_NOFILE
|
||||
except ImportError:
|
||||
return
|
||||
fd_limit, max_fds = resource.getrlimit(RLIMIT_NOFILE)
|
||||
|
|
|
@ -3,10 +3,9 @@ Tests common to list and UserList.UserList
|
|||
"""
|
||||
|
||||
import sys
|
||||
import os
|
||||
from functools import cmp_to_key
|
||||
|
||||
from test import support, seq_tests
|
||||
from test import seq_tests
|
||||
from test.support import ALWAYS_EQ, NEVER_EQ
|
||||
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
Various tests for synchronization primitives.
|
||||
"""
|
||||
|
||||
import os
|
||||
import gc
|
||||
import sys
|
||||
import time
|
||||
|
|
|
@ -29,7 +29,6 @@ if sys.platform not in ('win32', 'vxworks'):
|
|||
import asyncio
|
||||
from asyncio import coroutines
|
||||
from asyncio import events
|
||||
from asyncio import proactor_events
|
||||
from asyncio import selector_events
|
||||
from test.test_asyncio import utils as test_utils
|
||||
from test import support
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import _thread
|
||||
import asyncio
|
||||
import contextvars
|
||||
import gc
|
||||
import re
|
||||
import signal
|
||||
import threading
|
||||
|
|
|
@ -5,7 +5,7 @@ import unittest
|
|||
|
||||
from asyncio import proactor_events
|
||||
from itertools import cycle, islice
|
||||
from unittest.mock import patch, Mock
|
||||
from unittest.mock import Mock
|
||||
from test.test_asyncio import utils as test_utils
|
||||
from test import support
|
||||
from test.support import socket_helper
|
||||
|
|
|
@ -1,22 +1,18 @@
|
|||
"""Tests for tasks.py."""
|
||||
|
||||
import collections
|
||||
import contextlib
|
||||
import contextvars
|
||||
import functools
|
||||
import gc
|
||||
import io
|
||||
import random
|
||||
import re
|
||||
import sys
|
||||
import textwrap
|
||||
import traceback
|
||||
import unittest
|
||||
from unittest import mock
|
||||
from types import GenericAlias
|
||||
|
||||
import asyncio
|
||||
from asyncio import coroutines
|
||||
from asyncio import futures
|
||||
from asyncio import tasks
|
||||
from test.test_asyncio import utils as test_utils
|
||||
|
|
|
@ -4,7 +4,6 @@ import unittest
|
|||
import time
|
||||
|
||||
import asyncio
|
||||
from asyncio import tasks
|
||||
|
||||
|
||||
def tearDownModule():
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import atexit
|
||||
import os
|
||||
import sys
|
||||
import textwrap
|
||||
import unittest
|
||||
from test import support
|
||||
|
|
|
@ -4,7 +4,7 @@ import unittest
|
|||
import binascii
|
||||
import array
|
||||
import re
|
||||
from test.support import bigmemtest, _1G, _4G, warnings_helper
|
||||
from test.support import bigmemtest, _1G, _4G
|
||||
|
||||
|
||||
# Note: "*_hex" functions are aliases for "(un)hexlify"
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import unittest
|
||||
from test import support
|
||||
from test.support import os_helper
|
||||
|
||||
import io # C implementation.
|
||||
|
|
|
@ -9,7 +9,6 @@ from unittest import mock
|
|||
|
||||
from test import support
|
||||
from test.support import os_helper
|
||||
from test.support import warnings_helper
|
||||
|
||||
try:
|
||||
import _testcapi
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
from test import support
|
||||
import unittest
|
||||
from types import MethodType
|
||||
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
"""Unit tests for collections.defaultdict."""
|
||||
|
||||
import os
|
||||
import copy
|
||||
import pickle
|
||||
import tempfile
|
||||
import unittest
|
||||
|
||||
from collections import defaultdict
|
||||
|
|
|
@ -3563,7 +3563,6 @@ order (MRO) for bases """
|
|||
def test_str_of_str_subclass(self):
|
||||
# Testing __str__ defined in subclass of str ...
|
||||
import binascii
|
||||
import io
|
||||
|
||||
class octetstring(str):
|
||||
def __str__(self):
|
||||
|
|
|
@ -7,7 +7,6 @@ import time
|
|||
import base64
|
||||
import unittest
|
||||
import textwrap
|
||||
import warnings
|
||||
|
||||
from io import StringIO, BytesIO
|
||||
from itertools import chain
|
||||
|
@ -45,7 +44,7 @@ from test.test_email import openfile, TestEmailBase
|
|||
|
||||
# These imports are documented to work, but we are testing them using a
|
||||
# different path, so we import them here just to make sure they are importable.
|
||||
from email.parser import FeedParser, BytesFeedParser
|
||||
from email.parser import FeedParser
|
||||
|
||||
NL = '\n'
|
||||
EMPTYSTRING = ''
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import collections.abc
|
||||
import traceback
|
||||
import types
|
||||
import unittest
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
# Python test set -- part 5, built-in exceptions
|
||||
|
||||
import copy
|
||||
import gc
|
||||
import os
|
||||
import sys
|
||||
import unittest
|
||||
|
|
|
@ -8,7 +8,6 @@ import time
|
|||
import unittest
|
||||
|
||||
from test import support
|
||||
from test.support import import_helper
|
||||
from test.test_grammar import (VALID_UNDERSCORE_LITERALS,
|
||||
INVALID_UNDERSCORE_LITERALS)
|
||||
from math import isinf, isnan, copysign, ldexp
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import __future__
|
||||
import unittest
|
||||
from test import support
|
||||
|
||||
|
||||
class FLUFLTests(unittest.TestCase):
|
||||
|
|
|
@ -13,7 +13,6 @@ import time
|
|||
import typing
|
||||
import unittest
|
||||
import unittest.mock
|
||||
import os
|
||||
import weakref
|
||||
import gc
|
||||
from weakref import proxy
|
||||
|
@ -21,7 +20,6 @@ import contextlib
|
|||
|
||||
from test.support import import_helper
|
||||
from test.support import threading_helper
|
||||
from test.support.script_helper import assert_python_ok
|
||||
|
||||
import functools
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
import __future__
|
||||
import ast
|
||||
import unittest
|
||||
from test import support
|
||||
from test.support import import_helper
|
||||
from textwrap import dedent
|
||||
import os
|
||||
|
|
|
@ -2,7 +2,6 @@ import copy
|
|||
import ntpath
|
||||
import pathlib
|
||||
import posixpath
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
from test.support import verbose
|
||||
|
|
|
@ -4,7 +4,6 @@ import random
|
|||
import unittest
|
||||
import doctest
|
||||
|
||||
from test import support
|
||||
from test.support import import_helper
|
||||
from unittest import TestCase, skipUnless
|
||||
from operator import itemgetter
|
||||
|
|
|
@ -4,7 +4,6 @@ import os
|
|||
import stat
|
||||
import sys
|
||||
import re
|
||||
import test.support
|
||||
from test.support import os_helper
|
||||
from test.support import warnings_helper
|
||||
import time
|
||||
|
|
|
@ -10,9 +10,7 @@ import calendar
|
|||
import threading
|
||||
import socket
|
||||
|
||||
from test.support import (verbose,
|
||||
run_with_tz, run_with_locale, cpython_only,
|
||||
requires_working_socket)
|
||||
from test.support import verbose, run_with_tz, run_with_locale, cpython_only
|
||||
from test.support import hashlib_helper
|
||||
from test.support import threading_helper
|
||||
from test.support import warnings_helper
|
||||
|
|
|
@ -2,7 +2,6 @@ import io
|
|||
import marshal
|
||||
import os
|
||||
import sys
|
||||
from test import support
|
||||
from test.support import import_helper
|
||||
import types
|
||||
import unittest
|
||||
|
|
|
@ -6,7 +6,6 @@ machinery = test_util.import_importlib('importlib.machinery')
|
|||
|
||||
import os.path
|
||||
import sys
|
||||
from test import support
|
||||
from test.support import import_helper
|
||||
from test.support import os_helper
|
||||
import types
|
||||
|
|
|
@ -7,7 +7,6 @@ import subprocess
|
|||
import sys
|
||||
import sysconfig
|
||||
import tempfile
|
||||
import textwrap
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
from test import support
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import dis
|
||||
import sys
|
||||
import textwrap
|
||||
import unittest
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ import os
|
|||
import sys
|
||||
import test.support
|
||||
import unittest
|
||||
import warnings
|
||||
from test.support import os_helper
|
||||
from test.support import warnings_helper
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
from test import support
|
||||
from test.support import import_helper
|
||||
import unittest
|
||||
import warnings
|
||||
|
|
|
@ -15,7 +15,6 @@ import sys
|
|||
import sysconfig
|
||||
import tempfile
|
||||
import textwrap
|
||||
import time
|
||||
import unittest
|
||||
from test import libregrtest
|
||||
from test import support
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import errno
|
||||
import os
|
||||
import select
|
||||
import subprocess
|
||||
import sys
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
import unittest
|
||||
import dbm
|
||||
import shelve
|
||||
import glob
|
||||
import pickle
|
||||
import os
|
||||
|
||||
from test import support
|
||||
from test.support import os_helper
|
||||
from collections.abc import MutableMapping
|
||||
from test.test_dbm import dbm_iterator
|
||||
|
|
|
@ -10,10 +10,9 @@ from test import support
|
|||
from test.support import os_helper
|
||||
from test.support import socket_helper
|
||||
from test.support import captured_stderr
|
||||
from test.support.os_helper import TESTFN, EnvironmentVarGuard, change_cwd
|
||||
from test.support.os_helper import TESTFN, EnvironmentVarGuard
|
||||
import ast
|
||||
import builtins
|
||||
import encodings
|
||||
import glob
|
||||
import io
|
||||
import os
|
||||
|
|
|
@ -3,7 +3,6 @@ from test.support import import_helper, load_package_tests, verbose
|
|||
# Skip test if _sqlite3 module not installed.
|
||||
import_helper.import_module('_sqlite3')
|
||||
|
||||
import unittest
|
||||
import os
|
||||
import sqlite3
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@ from test.support import (
|
|||
from test.support.import_helper import import_module
|
||||
from test.support.os_helper import (TESTFN, unlink, skip_unless_symlink,
|
||||
change_cwd)
|
||||
from test.support.warnings_helper import check_warnings
|
||||
|
||||
import sysconfig
|
||||
from sysconfig import (get_paths, get_platform, get_config_vars,
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
import unittest
|
||||
import locale
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
import os
|
||||
import warnings
|
||||
from test import support
|
||||
from test.support import import_helper
|
||||
from test.support import os_helper
|
||||
|
|
|
@ -4,7 +4,6 @@ from doctest import DocTestSuite
|
|||
from test import support
|
||||
from test.support import threading_helper
|
||||
import weakref
|
||||
import gc
|
||||
|
||||
# Modules under test
|
||||
import _thread
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
"""Tests for the md5sum script in the Tools directory."""
|
||||
|
||||
import sys
|
||||
import os
|
||||
import unittest
|
||||
from test.support import os_helper
|
||||
|
|
|
@ -2,7 +2,6 @@ import os
|
|||
import subprocess
|
||||
import sys
|
||||
import unittest
|
||||
from test import support
|
||||
from test.support import os_helper
|
||||
from test.test_tools import scriptsdir, skip_if_missing
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@ import sys
|
|||
import unittest
|
||||
import subprocess
|
||||
import textwrap
|
||||
from test import support
|
||||
from test.support import os_helper
|
||||
from test.support.script_helper import assert_python_ok
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@ from test.support import (Error, captured_output, cpython_only, ALWAYS_EQ,
|
|||
from test.support.os_helper import TESTFN, unlink
|
||||
from test.support.script_helper import assert_python_ok, assert_python_failure
|
||||
|
||||
import os
|
||||
import textwrap
|
||||
import traceback
|
||||
from functools import partial
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import ast
|
||||
import sys
|
||||
import unittest
|
||||
from test import support
|
||||
|
||||
|
||||
funcdef = """\
|
||||
|
|
|
@ -4,7 +4,6 @@ import _pyio as pyio
|
|||
import unittest
|
||||
import os
|
||||
import sys
|
||||
from test import support
|
||||
from test.support import os_helper
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import unittest
|
||||
from test import support
|
||||
from test.support import os_helper
|
||||
from test.support import socket_helper
|
||||
from test.support import warnings_helper
|
||||
from test import test_urllib
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ import struct
|
|||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
from test.support import (captured_stdout, captured_stderr, requires_zlib,
|
||||
from test.support import (captured_stdout, captured_stderr,
|
||||
skip_if_broken_multiprocessing_synchronize, verbose,
|
||||
requires_subprocess, is_emscripten, is_wasi,
|
||||
requires_venv_with_pip)
|
||||
|
|
Loading…
Reference in New Issue