From 5a8a979aeb7c9494949cbe5142d37dc5781a7bde Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Mon, 17 Jun 2024 21:05:37 +0200 Subject: [PATCH] gh-120417: Remove unused imports in tests (part 2) (#120630) --- Lib/test/test_dbm_sqlite3.py | 3 +-- Lib/test/test_decorators.py | 2 +- Lib/test/test_email/test_headerregistry.py | 1 - Lib/test/test_email/test_utils.py | 4 +--- Lib/test/test_ensurepip.py | 1 - Lib/test/test_fractions.py | 1 - Lib/test/test_frame.py | 4 +--- Lib/test/test_free_threading/test_str.py | 1 - Lib/test/test_free_threading/test_type.py | 2 +- Lib/test/test_fstring.py | 1 - 10 files changed, 5 insertions(+), 15 deletions(-) diff --git a/Lib/test/test_dbm_sqlite3.py b/Lib/test/test_dbm_sqlite3.py index 7a49fd2f924..2e1f2d32924 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 3a4fc959f6f..78361be9fa1 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 5a608a033c7..4c0523f4103 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 8556a93699d..4e6201e13c8 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 a4b36a90d88..6d3c91b0b6d 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 71865f68eb0..589669298e2 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 aee8d374b22..42f93822a3d 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 f5e93b7de0a..72044e979b0 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 1e84b2db2d4..75259795e81 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 27c7f70cef3..49c6f761e5b 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