From: Victor Stinner Date: Mon, 17 Jun 2024 19:05:37 +0000 (+0200) Subject: gh-120417: Remove unused imports in tests (part 2) (#120630) X-Git-Tag: v3.14.0a1~1450 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5a8a979aeb7c9494949cbe5142d37dc5781a7bde;p=thirdparty%2FPython%2Fcpython.git gh-120417: Remove unused imports in tests (part 2) (#120630) --- diff --git a/Lib/test/test_dbm_sqlite3.py b/Lib/test/test_dbm_sqlite3.py index 7a49fd2f924f..2e1f2d32924b 100644 --- a/Lib/test/test_dbm_sqlite3.py +++ b/Lib/test/test_dbm_sqlite3.py @@ -1,10 +1,9 @@ import sys -import test.support import unittest from contextlib import closing from functools import partial from pathlib import Path -from test.support import cpython_only, import_helper, os_helper +from test.support import import_helper, os_helper dbm_sqlite3 = import_helper.import_module("dbm.sqlite3") # N.B. The test will fail on some platforms without sqlite3 diff --git a/Lib/test/test_decorators.py b/Lib/test/test_decorators.py index 3a4fc959f6f8..78361be9fa1e 100644 --- a/Lib/test/test_decorators.py +++ b/Lib/test/test_decorators.py @@ -1,5 +1,5 @@ import unittest -from types import MethodType + def funcattrs(**kwds): def decorate(func): diff --git a/Lib/test/test_email/test_headerregistry.py b/Lib/test/test_email/test_headerregistry.py index 5a608a033c7e..4c0523f41033 100644 --- a/Lib/test/test_email/test_headerregistry.py +++ b/Lib/test/test_email/test_headerregistry.py @@ -7,7 +7,6 @@ from email.message import Message from test.test_email import TestEmailBase, parameterize from email import headerregistry from email.headerregistry import Address, Group -from email.header import decode_header from test.support import ALWAYS_EQ diff --git a/Lib/test/test_email/test_utils.py b/Lib/test/test_email/test_utils.py index 8556a93699d1..4e6201e13c87 100644 --- a/Lib/test/test_email/test_utils.py +++ b/Lib/test/test_email/test_utils.py @@ -3,9 +3,7 @@ from email import utils import test.support import time import unittest -import sys -import os.path -import zoneinfo + class DateTimeTests(unittest.TestCase): diff --git a/Lib/test/test_ensurepip.py b/Lib/test/test_ensurepip.py index a4b36a90d881..6d3c91b0b6d9 100644 --- a/Lib/test/test_ensurepip.py +++ b/Lib/test/test_ensurepip.py @@ -6,7 +6,6 @@ import tempfile import test.support import unittest import unittest.mock -from importlib.resources.abc import Traversable from pathlib import Path import ensurepip diff --git a/Lib/test/test_fractions.py b/Lib/test/test_fractions.py index 71865f68eb0f..589669298e22 100644 --- a/Lib/test/test_fractions.py +++ b/Lib/test/test_fractions.py @@ -1,6 +1,5 @@ """Tests for Lib/fractions.py.""" -import cmath from decimal import Decimal from test.support import requires_IEEE_754 import math diff --git a/Lib/test/test_frame.py b/Lib/test/test_frame.py index aee8d374b227..42f93822a3df 100644 --- a/Lib/test/test_frame.py +++ b/Lib/test/test_frame.py @@ -1,11 +1,9 @@ import copy -import gc import operator import re import sys import textwrap import threading -import types import unittest import weakref try: @@ -14,7 +12,7 @@ except ImportError: _testcapi = None from test import support -from test.support import import_helper, threading_helper, Py_GIL_DISABLED +from test.support import import_helper, threading_helper from test.support.script_helper import assert_python_ok diff --git a/Lib/test/test_free_threading/test_str.py b/Lib/test/test_free_threading/test_str.py index f5e93b7de0aa..72044e979b0f 100644 --- a/Lib/test/test_free_threading/test_str.py +++ b/Lib/test/test_free_threading/test_str.py @@ -1,4 +1,3 @@ -import sys import unittest from itertools import cycle diff --git a/Lib/test/test_free_threading/test_type.py b/Lib/test/test_free_threading/test_type.py index 1e84b2db2d48..75259795e81b 100644 --- a/Lib/test/test_free_threading/test_type.py +++ b/Lib/test/test_free_threading/test_type.py @@ -5,7 +5,7 @@ from concurrent.futures import ThreadPoolExecutor from threading import Thread from unittest import TestCase -from test.support import threading_helper, import_helper +from test.support import threading_helper diff --git a/Lib/test/test_fstring.py b/Lib/test/test_fstring.py index 27c7f70cef32..49c6f761e5b4 100644 --- a/Lib/test/test_fstring.py +++ b/Lib/test/test_fstring.py @@ -14,7 +14,6 @@ import re import types import decimal import unittest -import warnings from test import support from test.support.os_helper import temp_cwd from test.support.script_helper import assert_python_failure, assert_python_ok