From 65ed5a7a1a1d6d960079ddfa31725794300f2af1 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Mon, 17 Jun 2024 13:44:06 +0200 Subject: [PATCH] gh-120417: Remove unused imports in tests (part 2) --- 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 7a49fd2f924f8d..2e1f2d32924bad 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 3a4fc959f6f8a7..78361be9fa1e61 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 5a608a033c7e54..4c0523f410332f 100644 --- a/Lib/test/test_email/test_headerregistry.py +++ b/Lib/test/test_email/test_headerregistry.py @@ -7,7 +7,6 @@ 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 8556a93699d194..4e6201e13c87f9 100644 --- a/Lib/test/test_email/test_utils.py +++ b/Lib/test/test_email/test_utils.py @@ -3,9 +3,7 @@ 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 a4b36a90d8815e..6d3c91b0b6d9f9 100644 --- a/Lib/test/test_ensurepip.py +++ b/Lib/test/test_ensurepip.py @@ -6,7 +6,6 @@ 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 71865f68eb0f12..589669298e22e2 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 aee8d374b22710..42f93822a3df60 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 @@ _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 f5e93b7de0aa9b..72044e979b0f48 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 1e84b2db2d4882..75259795e81bcb 100644 --- a/Lib/test/test_free_threading/test_type.py +++ b/Lib/test/test_free_threading/test_type.py @@ -5,7 +5,7 @@ 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 27c7f70cef32e3..49c6f761e5b4f0 100644 --- a/Lib/test/test_fstring.py +++ b/Lib/test/test_fstring.py @@ -14,7 +14,6 @@ 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