Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-84623: Remove unused imports in tests #93772

Merged
merged 3 commits into from
Jun 13, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Lib/test/datetimetester.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import bisect
import copy
import decimal
import functools
import sys
import os
import pickle
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/libregrtest/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 1 addition & 2 deletions Lib/test/list_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
"""

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


Expand Down
1 change: 0 additions & 1 deletion Lib/test/lock_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
Various tests for synchronization primitives.
"""

import os
import gc
import sys
import time
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_asyncio/test_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
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
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_asyncio/test_runners.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import _thread
import asyncio
import contextvars
import gc
import re
import signal
import threading
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_asyncio/test_sock_lowlevel.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

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
Expand Down
4 changes: 0 additions & 4 deletions Lib/test/test_asyncio/test_tasks.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_asyncio/test_timeouts.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import time

import asyncio
from asyncio import tasks


def tearDownModule():
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_atexit.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import atexit
import os
import sys
import textwrap
import unittest
from test import support
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_binascii.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
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"
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_bufio.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import unittest
from test import support
from test.support import os_helper

import io # C implementation.
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_codecs.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

from test import support
from test.support import os_helper
from test.support import warnings_helper

try:
import _testcapi
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_decorators.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from test import support
import unittest
from types import MethodType

Expand Down
2 changes: 0 additions & 2 deletions Lib/test/test_defaultdict.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
"""Unit tests for collections.defaultdict."""

import os
import copy
import pickle
import tempfile
import unittest

from collections import defaultdict
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_descr.py
Original file line number Diff line number Diff line change
Expand Up @@ -3563,7 +3563,6 @@ class MyInt(int):
def test_str_of_str_subclass(self):
# Testing __str__ defined in subclass of str ...
import binascii
import io

class octetstring(str):
def __str__(self):
Expand Down
3 changes: 1 addition & 2 deletions Lib/test/test_email/test_email.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import base64
import unittest
import textwrap
import warnings

from io import StringIO, BytesIO
from itertools import chain
Expand Down Expand Up @@ -45,7 +44,7 @@

# 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 = ''
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_exception_group.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import collections.abc
import traceback
import types
import unittest

Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_exceptions.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Python test set -- part 5, built-in exceptions

import copy
import gc
import os
import sys
import unittest
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_extcall.py
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,6 @@

import doctest
import unittest
from test import support

def load_tests(loader, tests, pattern):
tests.addTest(doctest.DocTestSuite())
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_float.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
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
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_flufl.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import __future__
import unittest
from test import support


class FLUFLTests(unittest.TestCase):
Expand Down
2 changes: 0 additions & 2 deletions Lib/test/test_functools.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,13 @@
import typing
import unittest
import unittest.mock
import os
import weakref
import gc
from weakref import proxy
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

Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_future.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_getpath.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import ntpath
import pathlib
import posixpath
import sys
import unittest

from test.support import verbose
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_heapq.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import unittest
import doctest

from test import support
from test.support import import_helper
from unittest import TestCase, skipUnless
from operator import itemgetter
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_http_cookiejar.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import stat
import sys
import re
import test.support
from test.support import os_helper
from test.support import warnings_helper
import time
Expand Down
4 changes: 1 addition & 3 deletions Lib/test/test_imaplib.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
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
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_importlib/test_abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import marshal
import os
import sys
from test import support
from test.support import import_helper
import types
import unittest
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_importlib/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import os.path
import sys
from test import support
from test.support import import_helper
from test.support import os_helper
import types
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import sys
import sysconfig
import tempfile
import textwrap
import unittest
from pathlib import Path
from test import support
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_lltrace.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import dis
import sys
import textwrap
import unittest

Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_mailcap.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import sys
import test.support
import unittest
import warnings
from test.support import os_helper
from test.support import warnings_helper

Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_nis.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from test import support
from test.support import import_helper
import unittest
import warnings
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_regrtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import sysconfig
import tempfile
import textwrap
import time
import unittest
from test import libregrtest
from test import support
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_select.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import errno
import os
import select
import subprocess
import sys
Expand Down
2 changes: 0 additions & 2 deletions Lib/test/test_shelve.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 1 addition & 2 deletions Lib/test/test_site.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@
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
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_sqlite3/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
# Skip test if _sqlite3 module not installed.
import_helper.import_module('_sqlite3')

import unittest
import os
import sqlite3

Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_sysconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
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,
Expand Down
3 changes: 0 additions & 3 deletions Lib/test/test_tcl.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_threading_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from test import support
from test.support import threading_helper
import weakref
import gc

# Modules under test
import _thread
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_tools/test_md5sum.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_tools/test_pathfix.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
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

Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_tools/test_pindent.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
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

Expand Down
Loading