From 57572b103ebd8732ac21922f0051a7f140d0e405 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Thu, 30 Apr 2020 01:48:37 +0200 Subject: [PATCH] bpo-40443: Remove unused imports in tests (GH-19805) --- Lib/test/test_parser.py | 1 - Lib/test/test_peg_parser.py | 3 --- Lib/test/test_platform.py | 1 - Lib/test/test_positional_only_arg.py | 1 - Lib/test/test_pstats.py | 1 - Lib/test/test_re.py | 2 +- Lib/test/test_regrtest.py | 1 - Lib/test/test_string_literals.py | 2 +- Lib/test/test_support.py | 1 - Lib/test/test_syntax.py | 1 - Lib/test/test_tempfile.py | 1 - .../test_c_analyzer/test_parser/test_preprocessor.py | 1 - Lib/test/test_tools/test_lll.py | 1 - Lib/test/test_tools/test_pathfix.py | 2 +- Lib/test/test_typing.py | 2 +- Lib/test/test_unparse.py | 1 - Lib/test/test_uuid.py | 2 -- 17 files changed, 4 insertions(+), 20 deletions(-) diff --git a/Lib/test/test_parser.py b/Lib/test/test_parser.py index fd33d6529b1..a4d2cdc090a 100644 --- a/Lib/test/test_parser.py +++ b/Lib/test/test_parser.py @@ -8,7 +8,6 @@ import pickle import unittest import operator import struct -import sys from test import support from test.support.script_helper import assert_python_failure from test.support.script_helper import assert_python_ok diff --git a/Lib/test/test_peg_parser.py b/Lib/test/test_peg_parser.py index 43d30bae849..191494481eb 100644 --- a/Lib/test/test_peg_parser.py +++ b/Lib/test/test_peg_parser.py @@ -1,9 +1,6 @@ import ast -import os -import sys import _peg_parser as peg_parser import unittest -from pathlib import PurePath from typing import Any, Union, Iterable, Tuple from textwrap import dedent from test import support diff --git a/Lib/test/test_platform.py b/Lib/test/test_platform.py index 998f1e0dc31..7664b38a720 100644 --- a/Lib/test/test_platform.py +++ b/Lib/test/test_platform.py @@ -3,7 +3,6 @@ import platform import subprocess import sys import unittest -import collections from unittest import mock from test import support diff --git a/Lib/test/test_positional_only_arg.py b/Lib/test/test_positional_only_arg.py index 4d5fb6bc611..f7bd4018043 100644 --- a/Lib/test/test_positional_only_arg.py +++ b/Lib/test/test_positional_only_arg.py @@ -3,7 +3,6 @@ import dis import pickle import unittest -import sys from test.support import check_syntax_error, use_old_parser diff --git a/Lib/test/test_pstats.py b/Lib/test/test_pstats.py index f3a6e586c3b..10559deb6bc 100644 --- a/Lib/test/test_pstats.py +++ b/Lib/test/test_pstats.py @@ -5,7 +5,6 @@ from io import StringIO from pstats import SortKey import pstats -import time import cProfile class AddCallersTestCase(unittest.TestCase): diff --git a/Lib/test/test_re.py b/Lib/test/test_re.py index 4817d761a22..1bfbcb853c4 100644 --- a/Lib/test/test_re.py +++ b/Lib/test/test_re.py @@ -2217,7 +2217,7 @@ class ExternalTests(unittest.TestCase): def test_re_tests(self): 're_tests test suite' - from test.re_tests import tests, SUCCEED, FAIL, SYNTAX_ERROR + from test.re_tests import tests, FAIL, SYNTAX_ERROR for t in tests: pattern = s = outcome = repl = expected = None if len(t) == 5: diff --git a/Lib/test/test_regrtest.py b/Lib/test/test_regrtest.py index 93f8d44ec69..de209da41a3 100644 --- a/Lib/test/test_regrtest.py +++ b/Lib/test/test_regrtest.py @@ -5,7 +5,6 @@ Note: test_regrtest cannot be run twice in parallel. """ import contextlib -import faulthandler import glob import io import os.path diff --git a/Lib/test/test_string_literals.py b/Lib/test/test_string_literals.py index 5a2fb8b372f..5b5477d14d4 100644 --- a/Lib/test/test_string_literals.py +++ b/Lib/test/test_string_literals.py @@ -33,7 +33,7 @@ import shutil import tempfile import unittest import warnings -from test.support import check_syntax_warning, use_old_parser +from test.support import use_old_parser TEMPLATE = r"""# coding: %s diff --git a/Lib/test/test_support.py b/Lib/test/test_support.py index 606e57003ed..b5a16f9cb60 100644 --- a/Lib/test/test_support.py +++ b/Lib/test/test_support.py @@ -1,4 +1,3 @@ -import contextlib import errno import importlib import io diff --git a/Lib/test/test_syntax.py b/Lib/test/test_syntax.py index aff8dd72b78..e7468cae7b1 100644 --- a/Lib/test/test_syntax.py +++ b/Lib/test/test_syntax.py @@ -644,7 +644,6 @@ Corner-cases that used to crash: """ import re -import sys import unittest from test import support diff --git a/Lib/test/test_tempfile.py b/Lib/test/test_tempfile.py index 69d5de2e1b9..fcc706ede5a 100644 --- a/Lib/test/test_tempfile.py +++ b/Lib/test/test_tempfile.py @@ -4,7 +4,6 @@ import errno import io import os import pathlib -import signal import sys import re import warnings diff --git a/Lib/test/test_tools/test_c_analyzer/test_parser/test_preprocessor.py b/Lib/test/test_tools/test_c_analyzer/test_parser/test_preprocessor.py index 56a1c9c612f..b7f950f8139 100644 --- a/Lib/test/test_tools/test_c_analyzer/test_parser/test_preprocessor.py +++ b/Lib/test/test_tools/test_c_analyzer/test_parser/test_preprocessor.py @@ -1,4 +1,3 @@ -import itertools import textwrap import unittest import sys diff --git a/Lib/test/test_tools/test_lll.py b/Lib/test/test_tools/test_lll.py index b01e2188e1c..568cbfb5e47 100644 --- a/Lib/test/test_tools/test_lll.py +++ b/Lib/test/test_tools/test_lll.py @@ -1,7 +1,6 @@ """Tests for the lll script in the Tools/script directory.""" import os -import sys import tempfile from test import support from test.test_tools import skip_if_missing, import_tool diff --git a/Lib/test/test_tools/test_pathfix.py b/Lib/test/test_tools/test_pathfix.py index ec361178e6d..8b419307340 100644 --- a/Lib/test/test_tools/test_pathfix.py +++ b/Lib/test/test_tools/test_pathfix.py @@ -3,7 +3,7 @@ import subprocess import sys import unittest from test import support -from test.test_tools import import_tool, scriptsdir, skip_if_missing +from test.test_tools import scriptsdir, skip_if_missing # need Tools/script/ directory: skip if run on Python installed on the system diff --git a/Lib/test/test_typing.py b/Lib/test/test_typing.py index f191d3bb9e9..cab8de0f5ef 100644 --- a/Lib/test/test_typing.py +++ b/Lib/test/test_typing.py @@ -3,7 +3,7 @@ import collections import pickle import re import sys -from unittest import TestCase, main, skipUnless, SkipTest, skip +from unittest import TestCase, main, skipUnless, skip from copy import copy, deepcopy from typing import Any, NoReturn diff --git a/Lib/test/test_unparse.py b/Lib/test/test_unparse.py index 3bacd672d44..b913569585a 100644 --- a/Lib/test/test_unparse.py +++ b/Lib/test/test_unparse.py @@ -6,7 +6,6 @@ import pathlib import random import tokenize import ast -import sys def read_pyfile(filename): diff --git a/Lib/test/test_uuid.py b/Lib/test/test_uuid.py index 0b267f4a978..ac166ced38a 100644 --- a/Lib/test/test_uuid.py +++ b/Lib/test/test_uuid.py @@ -6,8 +6,6 @@ import copy import io import os import pickle -import shutil -import subprocess import sys import weakref from unittest import mock