Skip to content

[3.7] Remove unused imports in tests (GH-14518) #14522

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Lib/test/libregrtest/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,6 @@ def create_temp_dir(self):

def cleanup(self):
import glob
import shutil

path = os.path.join(self.tmp_dir, 'test_python_*')
print("Cleanup %s directory" % self.tmp_dir)
Expand Down
2 changes: 0 additions & 2 deletions Lib/test/support/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@

import collections.abc
import contextlib
import datetime
import errno
import faulthandler
import fnmatch
import functools
import gc
import importlib
import importlib.util
import io
import logging.handlers
import nntplib
import os
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_aifc.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import sys
import struct
import aifc
import warnings


class AifcTest(audiotests.AudioWriteTests,
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_argparse.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Author: Steven J. Bethard <[email protected]>.

import codecs
import inspect
import os
import shutil
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_asynchat.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import errno
import socket
import sys
import _thread as thread
import threading
import time
import unittest
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_asyncio/test_pep492.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import types
import unittest

from test import support
from unittest import mock

import asyncio
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_asyncio/test_sslproto.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
from asyncio import log
from asyncio import protocols
from asyncio import sslproto
from asyncio import tasks
from test.test_asyncio import utils as test_utils
from test.test_asyncio import functional as func_tests

Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_asyncio/test_unix_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

import asyncio
from asyncio import log
from asyncio import base_events
from asyncio import events
from asyncio import unix_events
from test.test_asyncio import utils as test_utils
Expand Down
7 changes: 2 additions & 5 deletions Lib/test/test_c_locale_coercion.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,15 @@

import locale
import os
import shutil
import subprocess
import sys
import sysconfig
import unittest
from collections import namedtuple

import test.support
from test.support.script_helper import (
run_python_until_end,
interpreter_requires_environment,
)
from test.support.script_helper import run_python_until_end


# Set the list of ways we expect to be able to ask for the "C" locale
EXPECTED_C_LOCALE_EQUIVALENTS = ["C", "invalid.ascii"]
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_capi.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import re
import subprocess
import sys
import sysconfig
import textwrap
import threading
import time
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_cmd_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import os
import subprocess
import sys
import sysconfig
import tempfile
import unittest
from test import support
Expand Down
2 changes: 0 additions & 2 deletions Lib/test/test_collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
import collections
import copy
import doctest
import keyword
import operator
import pickle
from random import choice, randrange
import re
import string
import sys
from test import support
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_contextlib.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Unit tests for contextlib.py, and other context managers."""

import asyncio
import io
import sys
import tempfile
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_coroutines.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import copy
import inspect
import pickle
import re
import sys
import types
import unittest
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_docxmlrpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import http.client
import sys
import threading
from test import support
import unittest

def make_request_and_skipIf(condition, reason):
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_email/test_policy.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import io
import sys
import types
import textwrap
import unittest
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import errno

from test.support import (TESTFN, captured_stderr, check_impl_detail,
check_warnings, cpython_only, gc_collect, run_unittest,
check_warnings, cpython_only, gc_collect,
no_tracing, unlink, import_module, script_helper,
SuppressCrashReport)
class NaiveException(Exception):
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_faulthandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from test import support
from test.support import script_helper, is_android
import tempfile
import threading
import unittest
from textwrap import dedent

Expand Down
3 changes: 1 addition & 2 deletions Lib/test/test_fork1.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
import unittest

from test.fork_wait import ForkWait
from test.support import (reap_children, get_attribute,
import_module, verbose)
from test.support import reap_children, get_attribute, verbose


# Skip test if fork does not exist.
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_frozen.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import sys
import unittest
from test.support import captured_stdout
from importlib import util


class TestFrozen(unittest.TestCase):
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_gdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
# The code for testing gdb was adapted from similar work in Unladen Swallow's
# Lib/test/test_jit_gdb.py

import locale
import os
import platform
import re
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import pickle
import sys
import unittest
import warnings
import weakref
import inspect

Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_gettext.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import os
import base64
import gettext
import locale
import unittest

from test import support
Expand Down
2 changes: 0 additions & 2 deletions Lib/test/test_grammar.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@
from test.support import check_syntax_error
import inspect
import unittest
import sys
# testing import *
from sys import *

# different import patterns to check that __annotations__ does not interfere
# with import machinery
import test.ann_module as ann_module
import typing
from collections import ChainMap
from test import ann_module2
import test

Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_imaplib.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from test import support

from contextlib import contextmanager
import errno
import imaplib
import os.path
import socketserver
Expand Down
7 changes: 3 additions & 4 deletions Lib/test/test_import/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import builtins
import marshal
import os
import platform
import py_compile
import random
import stat
Expand All @@ -20,9 +19,9 @@

import test.support
from test.support import (
EnvironmentVarGuard, TESTFN, check_warnings, forget, is_jython,
make_legacy_pyc, rmtree, run_unittest, swap_attr, swap_item, temp_umask,
unlink, unload, create_empty_file, cpython_only, TESTFN_UNENCODABLE,
TESTFN, forget, is_jython,
make_legacy_pyc, rmtree, swap_attr, swap_item, temp_umask,
unlink, unload, cpython_only, TESTFN_UNENCODABLE,
temp_dir, DirsOnSysPath)
from test.support import script_helper
from test.test_importlib.util import uncache
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_importlib/test_locks.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import sys
import threading
import unittest
import weakref

from test import support
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_locale.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import locale
import sys
import codecs
import warnings


class BaseLocalizedTest(unittest.TestCase):
#
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_netrc.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import netrc, os, unittest, sys, tempfile, textwrap
from unittest import mock
from test import support


Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_os.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import decimal
import errno
import fractions
import getpass
import itertools
import locale
import mmap
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_posixpath.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import os
import posixpath
import unittest
import warnings
from posixpath import realpath, abspath, dirname, basename
from test import support, test_genericpath
from test.support import FakePath
Expand All @@ -12,6 +11,7 @@
except ImportError:
posix = None


# An absolute path to a temporary filename for testing. We can't rely on TESTFN
# being an absolute path, so we need this.

Expand Down
3 changes: 0 additions & 3 deletions Lib/test/test_pyclbr.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,11 @@
Nick Mathewson
'''

import os
import sys
from textwrap import dedent
from types import FunctionType, MethodType, BuiltinFunctionType
import pyclbr
from unittest import TestCase, main as unittest_main
from test import support
from functools import partial

StaticMethodType = type(staticmethod(lambda: None))
ClassMethodType = type(classmethod(lambda c: None))
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_pydoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import xml.etree
import xml.etree.ElementTree
import textwrap
import threading
from io import StringIO
from collections import namedtuple
from test.support.script_helper import assert_python_ok
Expand Down
2 changes: 0 additions & 2 deletions Lib/test/test_queue.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# Some simple queue module tests, plus some failure conditions
# to ensure the Queue locks remain stable.
import collections
import itertools
import queue
import random
import sys
import threading
import time
import unittest
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_resource.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import contextlib
import sys
import os
import unittest
from test import support
import time
Expand Down
3 changes: 1 addition & 2 deletions Lib/test/test_runpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
from test.support import (
forget, make_legacy_pyc, unload, verbose, no_tracing,
create_empty_file, temp_dir)
from test.support.script_helper import (
make_pkg, make_script, make_zip_pkg, make_zip_script)
from test.support.script_helper import make_script, make_zip_script


import runpy
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_sax.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
from xml.sax.xmlreader import InputSource, AttributesImpl, AttributesNSImpl
from io import BytesIO, StringIO
import codecs
import gc
import os.path
import shutil
from urllib.error import URLError
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_signal.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import statistics
import subprocess
import sys
import threading
import time
import unittest
from test import support
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_smtplib.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import unittest
from test import support, mock_socket
from test.support import HOST, HOSTv4, HOSTv6
from test.support import HOST
from unittest.mock import Mock


Expand Down
Loading