Skip to content

gh-131152: Remove unused imports in tests #131169

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

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 0 additions & 2 deletions Lib/test/test_asyncio/test_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import unittest
from unittest import mock
import weakref
import warnings
if sys.platform not in ('win32', 'vxworks'):
import tty

Expand All @@ -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)
Expand Down
5 changes: 1 addition & 4 deletions Lib/test/test_asyncio/test_streams.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
"""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:
ssl = None

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():
Expand Down
3 changes: 0 additions & 3 deletions Lib/test/test_asyncio/test_unix_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -27,7 +25,6 @@


import asyncio
from asyncio import log
from asyncio import unix_events
from test.test_asyncio import utils as test_utils

Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_asyncio/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import threading
import unittest
import weakref
import warnings
from ast import literal_eval
from unittest import mock

Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_builtin.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import random
import re
import sys
import textwrap
import traceback
import types
import typing
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_bytes.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import copy
import functools
import pickle
import sysconfig
import tempfile
import textwrap
import threading
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_call.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_capi/test_config.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""
Tests PyConfig_Get() and PyConfig_Set() C API (PEP 741).
"""
import os
import sys
import sysconfig
import types
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_capi/test_file.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_capi/test_getargs.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import unittest
import math
import string
import sys
from test import support
Expand Down
3 changes: 1 addition & 2 deletions Lib/test/test_capi/test_number.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_dynamic.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 0 additions & 2 deletions Lib/test/test_embed.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions Lib/test/test_pkgutil.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_pyrepl/support.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import os
from code import InteractiveConsole
from functools import partial
from typing import Iterable
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_pyrepl/test_eventqueue.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import tempfile
import unittest
import sys
from unittest.mock import patch
from test import support

Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_shutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import os.path
import errno
import functools
import pathlib
import subprocess
import random
import string
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_tarfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_thread_local_bytecode.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Tests for thread-local bytecode."""
import dis
import textwrap
import unittest

Expand Down
4 changes: 1 addition & 3 deletions Lib/test/test_types.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_userdict.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_userlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from collections import UserList
from test import list_tests
import unittest
from test import support


class UserListTest(list_tests.CommonTest):
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_zipfile/_path/test_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import pickle
import stat
import sys
import time
import unittest
import zipfile
import zipfile._path
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_zipfile/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading