gh-131152: Remove unused imports from tests (#131153)

This commit is contained in:
Victor Stinner 2025-03-13 10:55:23 +01:00 committed by GitHub
parent 0c6c52f496
commit 73ab9e2ede
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
22 changed files with 10 additions and 34 deletions

View file

@ -15,7 +15,7 @@ from .cmdline import _parse_args, Namespace
from .findtests import findtests, split_test_packages, list_cases from .findtests import findtests, split_test_packages, list_cases
from .logger import Logger from .logger import Logger
from .pgo import setup_pgo_tests from .pgo import setup_pgo_tests
from .result import State, TestResult from .result import TestResult
from .results import TestResults, EXITCODE_INTERRUPTED from .results import TestResults, EXITCODE_INTERRUPTED
from .runtests import RunTests, HuntRefleak from .runtests import RunTests, HuntRefleak
from .setup import setup_process, setup_test_dir from .setup import setup_process, setup_test_dir

View file

@ -1,7 +1,6 @@
"""Run a test case multiple times in parallel threads.""" """Run a test case multiple times in parallel threads."""
import copy import copy
import functools
import threading import threading
import unittest import unittest

View file

@ -7,7 +7,6 @@ import platform
import random import random
import re import re
import shlex import shlex
import signal
import subprocess import subprocess
import sys import sys
import sysconfig import sysconfig

View file

@ -6,7 +6,6 @@ import shlex
import sys import sys
import sysconfig import sysconfig
import tempfile import tempfile
import unittest
import venv import venv

View file

@ -22,7 +22,6 @@ import errno
import unittest import unittest
from unittest import mock from unittest import mock
import weakref import weakref
import warnings
if sys.platform not in ('win32', 'vxworks'): if sys.platform not in ('win32', 'vxworks'):
import tty import tty
@ -36,7 +35,6 @@ from test import support
from test.support import socket_helper from test.support import socket_helper
from test.support import threading_helper from test.support import threading_helper
from test.support import ALWAYS_EQ, LARGEST, SMALLEST from test.support import ALWAYS_EQ, LARGEST, SMALLEST
from test.support import warnings_helper
def tearDownModule(): def tearDownModule():
asyncio._set_event_loop_policy(None) asyncio._set_event_loop_policy(None)

View file

@ -1,15 +1,12 @@
"""Tests for streams.py.""" """Tests for streams.py."""
import gc import gc
import os
import queue import queue
import pickle import pickle
import socket import socket
import sys
import threading import threading
import unittest import unittest
from unittest import mock from unittest import mock
import warnings
try: try:
import ssl import ssl
except ImportError: except ImportError:
@ -17,7 +14,7 @@ except ImportError:
import asyncio import asyncio
from test.test_asyncio import utils as test_utils 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(): def tearDownModule():

View file

@ -10,11 +10,9 @@ import signal
import socket import socket
import stat import stat
import sys import sys
import threading
import time import time
import unittest import unittest
from unittest import mock from unittest import mock
import warnings
from test import support from test import support
from test.support import os_helper from test.support import os_helper
@ -27,7 +25,6 @@ if sys.platform == 'win32':
import asyncio import asyncio
from asyncio import log
from asyncio import unix_events from asyncio import unix_events
from test.test_asyncio import utils as test_utils from test.test_asyncio import utils as test_utils

View file

@ -14,7 +14,6 @@ import sys
import threading import threading
import unittest import unittest
import weakref import weakref
import warnings
from ast import literal_eval from ast import literal_eval
from unittest import mock from unittest import mock

View file

@ -16,7 +16,6 @@ import platform
import random import random
import re import re
import sys import sys
import textwrap
import traceback import traceback
import types import types
import typing import typing

View file

@ -11,7 +11,6 @@ import sys
import copy import copy
import functools import functools
import pickle import pickle
import sysconfig
import tempfile import tempfile
import textwrap import textwrap
import threading import threading

View file

@ -1,7 +1,9 @@
import unittest import unittest
from test.support import (cpython_only, is_wasi, requires_limited_api, Py_DEBUG, 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_if_sanitizer, import_helper) skip_emscripten_stack_overflow,
skip_wasi_stack_overflow, skip_if_sanitizer,
import_helper)
try: try:
import _testcapi import _testcapi
except ImportError: except ImportError:

View file

@ -1,7 +1,6 @@
""" """
Tests PyConfig_Get() and PyConfig_Set() C API (PEP 741). Tests PyConfig_Get() and PyConfig_Set() C API (PEP 741).
""" """
import os
import sys import sys
import sysconfig import sysconfig
import types import types

View file

@ -1,7 +1,6 @@
import io import io
import os import os
import unittest import unittest
import warnings
from test import support from test import support
from test.support import import_helper, os_helper, warnings_helper from test.support import import_helper, os_helper, warnings_helper

View file

@ -1,7 +1,6 @@
import unittest
import math
import string import string
import sys import sys
import unittest
from test import support from test import support
from test.support import import_helper from test.support import import_helper
from test.support import script_helper from test.support import script_helper

View file

@ -1,10 +1,9 @@
import itertools import itertools
import operator import operator
import sys
import unittest import unittest
import warnings import warnings
from test.support import cpython_only, import_helper from test.support import import_helper
_testcapi = import_helper.import_module('_testcapi') _testcapi = import_helper.import_module('_testcapi')
from _testcapi import PY_SSIZE_T_MAX, PY_SSIZE_T_MIN from _testcapi import PY_SSIZE_T_MAX, PY_SSIZE_T_MIN

View file

@ -1,7 +1,5 @@
import unittest import unittest
import sys
import gc import gc
from collections import namedtuple
from test.support import import_helper from test.support import import_helper
_testcapi = import_helper.import_module('_testcapi') _testcapi = import_helper.import_module('_testcapi')

View file

@ -2,7 +2,6 @@ import contextlib
import dis import dis
import io import io
import itertools import itertools
import marshal
import math import math
import opcode import opcode
import os import os

View file

@ -3,7 +3,6 @@ import contextlib
import io import io
import os import os
import pickle import pickle
import sys
import time import time
import unittest import unittest
from concurrent.futures.interpreter import ( from concurrent.futures.interpreter import (

View file

@ -1,6 +1,5 @@
import os import os
import queue import queue
import signal
import sys import sys
import threading import threading
import time import time

View file

@ -1,8 +1,7 @@
import unittest import unittest
import sys import sys
from ctypes import Structure, Union, sizeof, c_char, c_int from ctypes import Structure, Union, sizeof, c_char, c_int
from ._support import (CField, Py_TPFLAGS_DISALLOW_INSTANTIATION, from ._support import CField, Py_TPFLAGS_IMMUTABLETYPE
Py_TPFLAGS_IMMUTABLETYPE)
NOTHING = object() NOTHING = object()

View file

@ -4,7 +4,7 @@ import builtins
import sys import sys
import unittest 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): class RebindBuiltinsTests(unittest.TestCase):

View file

@ -1,12 +1,10 @@
# Run the tests in Programs/_testembed.c (tests for the CPython embedding APIs) # Run the tests in Programs/_testembed.c (tests for the CPython embedding APIs)
from test import support from test import support
from test.libregrtest.utils import get_build_info
from test.support import import_helper, os_helper, threading_helper, MS_WINDOWS from test.support import import_helper, os_helper, threading_helper, MS_WINDOWS
import unittest import unittest
from collections import namedtuple from collections import namedtuple
import contextlib import contextlib
import io
import json import json
import os import os
import os.path import os.path