From c99a103eb89fd4e0c72c88ef4716882668c384ab Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Thu, 30 Apr 2020 01:13:44 +0200 Subject: [PATCH] bpo-40443: Remove unused imports from tests --- 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 fd33d6529b1442..a4d2cdc090aa21 100644 --- a/Lib/test/test_parser.py +++ b/Lib/test/test_parser.py @@ -8,7 +8,6 @@ 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 ea4afa6e179732..c2760f3e22e79b 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 998f1e0dc315ab..7664b38a720a7e 100644 --- a/Lib/test/test_platform.py +++ b/Lib/test/test_platform.py @@ -3,7 +3,6 @@ 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 4d5fb6bc6112ca..f7bd401804364c 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 f3a6e586c3bccb..10559deb6bcb23 100644 --- a/Lib/test/test_pstats.py +++ b/Lib/test/test_pstats.py @@ -5,7 +5,6 @@ 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 4817d761a22df9..1bfbcb853c4ed1 100644 --- a/Lib/test/test_re.py +++ b/Lib/test/test_re.py @@ -2217,7 +2217,7 @@ def test_re_benchmarks(self): 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 93f8d44ec69380..de209da41a34dc 100644 --- a/Lib/test/test_regrtest.py +++ b/Lib/test/test_regrtest.py @@ -5,7 +5,6 @@ """ 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 5a2fb8b372f8c0..5b5477d14d467d 100644 --- a/Lib/test/test_string_literals.py +++ b/Lib/test/test_string_literals.py @@ -33,7 +33,7 @@ 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 606e57003ed711..b5a16f9cb60272 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 aff8dd72b78d47..e7468cae7b132d 100644 --- a/Lib/test/test_syntax.py +++ b/Lib/test/test_syntax.py @@ -644,7 +644,6 @@ """ 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 69d5de2e1b95f4..fcc706ede5aaa2 100644 --- a/Lib/test/test_tempfile.py +++ b/Lib/test/test_tempfile.py @@ -4,7 +4,6 @@ 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 56a1c9c612f726..b7f950f8139763 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 b01e2188e1cf20..568cbfb5e47460 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 ec361178e6d81f..8b4193073408b4 100644 --- a/Lib/test/test_tools/test_pathfix.py +++ b/Lib/test/test_tools/test_pathfix.py @@ -3,7 +3,7 @@ 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 f191d3bb9e90c8..cab8de0f5efb27 100644 --- a/Lib/test/test_typing.py +++ b/Lib/test/test_typing.py @@ -3,7 +3,7 @@ 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 3bacd672d4462c..b913569585a21b 100644 --- a/Lib/test/test_unparse.py +++ b/Lib/test/test_unparse.py @@ -6,7 +6,6 @@ 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 0b267f4a978613..ac166ced38afbc 100644 --- a/Lib/test/test_uuid.py +++ b/Lib/test/test_uuid.py @@ -6,8 +6,6 @@ import io import os import pickle -import shutil -import subprocess import sys import weakref from unittest import mock