mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 21:51:50 +00:00 
			
		
		
		
	Issue #23277: Remove unused imports in tests.
This commit is contained in:
		
							parent
							
								
									597d15afe4
								
							
						
					
					
						commit
						e437a10d15
					
				
					 79 changed files with 23 additions and 117 deletions
				
			
		|  | @ -49,7 +49,7 @@ def from_param(cls, value): | ||||||
| 
 | 
 | ||||||
|     # XXX Replace by c_char_p tests |     # XXX Replace by c_char_p tests | ||||||
|     def test_cstrings(self): |     def test_cstrings(self): | ||||||
|         from ctypes import c_char_p, byref |         from ctypes import c_char_p | ||||||
| 
 | 
 | ||||||
|         # c_char_p.from_param on a Python String packs the string |         # c_char_p.from_param on a Python String packs the string | ||||||
|         # into a cparam object |         # into a cparam object | ||||||
|  | @ -68,7 +68,7 @@ def test_cstrings(self): | ||||||
| 
 | 
 | ||||||
|     @need_symbol('c_wchar_p') |     @need_symbol('c_wchar_p') | ||||||
|     def test_cw_strings(self): |     def test_cw_strings(self): | ||||||
|         from ctypes import byref, c_wchar_p |         from ctypes import c_wchar_p | ||||||
| 
 | 
 | ||||||
|         c_wchar_p.from_param("123") |         c_wchar_p.from_param("123") | ||||||
| 
 | 
 | ||||||
|  | @ -98,7 +98,7 @@ def test_int_pointers(self): | ||||||
|     def test_byref_pointer(self): |     def test_byref_pointer(self): | ||||||
|         # The from_param class method of POINTER(typ) classes accepts what is |         # The from_param class method of POINTER(typ) classes accepts what is | ||||||
|         # returned by byref(obj), it type(obj) == typ |         # returned by byref(obj), it type(obj) == typ | ||||||
|         from ctypes import c_short, c_uint, c_int, c_long, pointer, POINTER, byref |         from ctypes import c_short, c_uint, c_int, c_long, POINTER, byref | ||||||
|         LPINT = POINTER(c_int) |         LPINT = POINTER(c_int) | ||||||
| 
 | 
 | ||||||
|         LPINT.from_param(byref(c_int(42))) |         LPINT.from_param(byref(c_int(42))) | ||||||
|  |  | ||||||
|  | @ -3,16 +3,12 @@ | ||||||
| import unittest | import unittest | ||||||
| import sys | import sys | ||||||
| import os | import os | ||||||
| import tempfile |  | ||||||
| import shutil |  | ||||||
| from test.support import run_unittest | from test.support import run_unittest | ||||||
| 
 | 
 | ||||||
| from distutils.core import Distribution | from distutils.core import Distribution | ||||||
| from distutils.command.bdist_rpm import bdist_rpm | from distutils.command.bdist_rpm import bdist_rpm | ||||||
| from distutils.tests import support | from distutils.tests import support | ||||||
| from distutils.spawn import find_executable | from distutils.spawn import find_executable | ||||||
| from distutils import spawn |  | ||||||
| from distutils.errors import DistutilsExecError |  | ||||||
| 
 | 
 | ||||||
| SETUP_PY = """\ | SETUP_PY = """\ | ||||||
| from distutils.core import setup | from distutils.core import setup | ||||||
|  |  | ||||||
|  | @ -166,7 +166,6 @@ def test_finalize_options(self): | ||||||
|         cmd = self.build_ext(dist) |         cmd = self.build_ext(dist) | ||||||
|         cmd.finalize_options() |         cmd.finalize_options() | ||||||
| 
 | 
 | ||||||
|         from distutils import sysconfig |  | ||||||
|         py_include = sysconfig.get_python_inc() |         py_include = sysconfig.get_python_inc() | ||||||
|         self.assertIn(py_include, cmd.include_dirs) |         self.assertIn(py_include, cmd.include_dirs) | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,7 +1,6 @@ | ||||||
| """Tests for distutils.command.clean.""" | """Tests for distutils.command.clean.""" | ||||||
| import os | import os | ||||||
| import unittest | import unittest | ||||||
| import getpass |  | ||||||
| 
 | 
 | ||||||
| from distutils.command.clean import clean | from distutils.command.clean import clean | ||||||
| from distutils.tests import support | from distutils.tests import support | ||||||
|  |  | ||||||
|  | @ -1,7 +1,6 @@ | ||||||
| """Tests for distutils.pypirc.pypirc.""" | """Tests for distutils.pypirc.pypirc.""" | ||||||
| import os | import os | ||||||
| import unittest | import unittest | ||||||
| import tempfile |  | ||||||
| 
 | 
 | ||||||
| from distutils.core import PyPIRCCommand | from distutils.core import PyPIRCCommand | ||||||
| from distutils.core import Distribution | from distutils.core import Distribution | ||||||
|  |  | ||||||
|  | @ -3,11 +3,10 @@ | ||||||
| import sys | import sys | ||||||
| import os | import os | ||||||
| from io import BytesIO | from io import BytesIO | ||||||
| import subprocess |  | ||||||
| from test.support import run_unittest | from test.support import run_unittest | ||||||
| 
 | 
 | ||||||
| from distutils import cygwinccompiler | from distutils import cygwinccompiler | ||||||
| from distutils.cygwinccompiler import (CygwinCCompiler, check_config_h, | from distutils.cygwinccompiler import (check_config_h, | ||||||
|                                        CONFIG_H_OK, CONFIG_H_NOTOK, |                                        CONFIG_H_OK, CONFIG_H_NOTOK, | ||||||
|                                        CONFIG_H_UNCERTAIN, get_versions, |                                        CONFIG_H_UNCERTAIN, get_versions, | ||||||
|                                        get_msvcr) |                                        get_msvcr) | ||||||
|  |  | ||||||
|  | @ -1,7 +1,6 @@ | ||||||
| """Tests for distutils.dep_util.""" | """Tests for distutils.dep_util.""" | ||||||
| import unittest | import unittest | ||||||
| import os | import os | ||||||
| import time |  | ||||||
| 
 | 
 | ||||||
| from distutils.dep_util import newer, newer_pairwise, newer_group | from distutils.dep_util import newer, newer_pairwise, newer_group | ||||||
| from distutils.errors import DistutilsFileError | from distutils.errors import DistutilsFileError | ||||||
|  |  | ||||||
|  | @ -1,7 +1,6 @@ | ||||||
| """Tests for distutils.file_util.""" | """Tests for distutils.file_util.""" | ||||||
| import unittest | import unittest | ||||||
| import os | import os | ||||||
| import shutil |  | ||||||
| import errno | import errno | ||||||
| from unittest.mock import patch | from unittest.mock import patch | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,7 +1,6 @@ | ||||||
| """Tests for distutils.command.install_data.""" | """Tests for distutils.command.install_data.""" | ||||||
| import os | import os | ||||||
| import unittest | import unittest | ||||||
| import getpass |  | ||||||
| 
 | 
 | ||||||
| from distutils.command.install_data import install_data | from distutils.command.install_data import install_data | ||||||
| from distutils.tests import support | from distutils.tests import support | ||||||
|  |  | ||||||
|  | @ -1,7 +1,6 @@ | ||||||
| """Tests for distutils.command.install_headers.""" | """Tests for distutils.command.install_headers.""" | ||||||
| import os | import os | ||||||
| import unittest | import unittest | ||||||
| import getpass |  | ||||||
| 
 | 
 | ||||||
| from distutils.command.install_headers import install_headers | from distutils.command.install_headers import install_headers | ||||||
| from distutils.tests import support | from distutils.tests import support | ||||||
|  |  | ||||||
|  | @ -1,11 +1,10 @@ | ||||||
| """Tests for distutils.spawn.""" | """Tests for distutils.spawn.""" | ||||||
| import unittest | import unittest | ||||||
| import os | import os | ||||||
| import time | from test.support import run_unittest | ||||||
| from test.support import captured_stdout, run_unittest |  | ||||||
| 
 | 
 | ||||||
| from distutils.spawn import _nt_quote_args | from distutils.spawn import _nt_quote_args | ||||||
| from distutils.spawn import spawn, find_executable | from distutils.spawn import spawn | ||||||
| from distutils.errors import DistutilsExecError | from distutils.errors import DistutilsExecError | ||||||
| from distutils.tests import support | from distutils.tests import support | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -10,7 +10,6 @@ | ||||||
| import test.support | import test.support | ||||||
| 
 | 
 | ||||||
| # Local imports | # Local imports | ||||||
| from lib2to3 import refactor |  | ||||||
| from . import support | from . import support | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -2,12 +2,11 @@ | ||||||
| 
 | 
 | ||||||
| # Python imports | # Python imports | ||||||
| import os | import os | ||||||
| import unittest |  | ||||||
| from itertools import chain | from itertools import chain | ||||||
| from operator import itemgetter | from operator import itemgetter | ||||||
| 
 | 
 | ||||||
| # Local imports | # Local imports | ||||||
| from lib2to3 import pygram, pytree, refactor, fixer_util | from lib2to3 import pygram, fixer_util | ||||||
| from lib2to3.tests import support | from lib2to3.tests import support | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -10,7 +10,7 @@ | ||||||
| 
 | 
 | ||||||
| # Testing imports | # Testing imports | ||||||
| from . import support | from . import support | ||||||
| from .support import driver, test_dir | from .support import driver | ||||||
| from test.support import verbose | from test.support import verbose | ||||||
| 
 | 
 | ||||||
| # Python imports | # Python imports | ||||||
|  |  | ||||||
|  | @ -11,8 +11,6 @@ | ||||||
| 
 | 
 | ||||||
| from __future__ import with_statement | from __future__ import with_statement | ||||||
| 
 | 
 | ||||||
| import warnings |  | ||||||
| 
 |  | ||||||
| # Testing imports | # Testing imports | ||||||
| from . import support | from . import support | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -7,18 +7,14 @@ | ||||||
| import sys | import sys | ||||||
| import os | import os | ||||||
| import codecs | import codecs | ||||||
| import operator |  | ||||||
| import io | import io | ||||||
| import tempfile | import tempfile | ||||||
| import shutil | import shutil | ||||||
| import unittest | import unittest | ||||||
| import warnings |  | ||||||
| 
 | 
 | ||||||
| from lib2to3 import refactor, pygram, fixer_base | from lib2to3 import refactor, pygram, fixer_base | ||||||
| from lib2to3.pgen2 import token | from lib2to3.pgen2 import token | ||||||
| 
 | 
 | ||||||
| from . import support |  | ||||||
| 
 |  | ||||||
| 
 | 
 | ||||||
| TEST_DATA_DIR = os.path.join(os.path.dirname(__file__), "data") | TEST_DATA_DIR = os.path.join(os.path.dirname(__file__), "data") | ||||||
| FIXER_DIR = os.path.join(TEST_DATA_DIR, "fixers") | FIXER_DIR = os.path.join(TEST_DATA_DIR, "fixers") | ||||||
|  |  | ||||||
|  | @ -1,5 +1,4 @@ | ||||||
| from test.support import findfile, TESTFN, unlink | from test.support import findfile, TESTFN, unlink | ||||||
| import unittest |  | ||||||
| import array | import array | ||||||
| import io | import io | ||||||
| import pickle | import pickle | ||||||
|  |  | ||||||
|  | @ -4,7 +4,6 @@ | ||||||
| except ImportError: | except ImportError: | ||||||
|     nl_langinfo = None |     nl_langinfo = None | ||||||
| 
 | 
 | ||||||
| import codecs |  | ||||||
| import locale | import locale | ||||||
| import sys | import sys | ||||||
| import unittest | import unittest | ||||||
|  |  | ||||||
|  | @ -4,7 +4,6 @@ | ||||||
| 
 | 
 | ||||||
| import os | import os | ||||||
| import platform | import platform | ||||||
| import shutil |  | ||||||
| import stat | import stat | ||||||
| import sys | import sys | ||||||
| import unittest | import unittest | ||||||
|  |  | ||||||
|  | @ -7,8 +7,6 @@ | ||||||
| import weakref | import weakref | ||||||
| import pickle | import pickle | ||||||
| import operator | import operator | ||||||
| import io |  | ||||||
| import math |  | ||||||
| import struct | import struct | ||||||
| import sys | import sys | ||||||
| import warnings | import warnings | ||||||
|  |  | ||||||
|  | @ -12,7 +12,6 @@ | ||||||
| import sys | import sys | ||||||
| import time | import time | ||||||
| import unittest | import unittest | ||||||
| import warnings |  | ||||||
| import unittest.mock | import unittest.mock | ||||||
| try: | try: | ||||||
|     import threading |     import threading | ||||||
|  |  | ||||||
|  | @ -14,7 +14,6 @@ | ||||||
| import unittest | import unittest | ||||||
| import operator | import operator | ||||||
| import sys | import sys | ||||||
| import functools |  | ||||||
| 
 | 
 | ||||||
| # These tests all use one of the bigmemtest decorators to indicate how much | # These tests all use one of the bigmemtest decorators to indicate how much | ||||||
| # memory they use and how much memory they need to be even meaningful.  The | # memory they use and how much memory they need to be even meaningful.  The | ||||||
|  |  | ||||||
|  | @ -2,7 +2,7 @@ | ||||||
| 
 | 
 | ||||||
| import unittest | import unittest | ||||||
| from test import support | from test import support | ||||||
| from operator import eq, ne, lt, gt, le, ge | from operator import eq, le | ||||||
| from abc import ABCMeta | from abc import ABCMeta | ||||||
| 
 | 
 | ||||||
| def gcd(a, b): | def gcd(a, b): | ||||||
|  |  | ||||||
|  | @ -16,7 +16,6 @@ | ||||||
| from test import support | from test import support | ||||||
| from itertools import permutations, product | from itertools import permutations, product | ||||||
| from random import randrange, sample, choice | from random import randrange, sample, choice | ||||||
| from sysconfig import get_config_var |  | ||||||
| import warnings | import warnings | ||||||
| import sys, array, io | import sys, array, io | ||||||
| from decimal import Decimal | from decimal import Decimal | ||||||
|  |  | ||||||
|  | @ -4,7 +4,6 @@ | ||||||
| import test.support | import test.support | ||||||
| import unicodedata | import unicodedata | ||||||
| import unittest | import unittest | ||||||
| import warnings |  | ||||||
| 
 | 
 | ||||||
| class PosReturn: | class PosReturn: | ||||||
|     # this can be used for configurable callbacks |     # this can be used for configurable callbacks | ||||||
|  |  | ||||||
|  | @ -4,7 +4,6 @@ | ||||||
| import locale | import locale | ||||||
| import sys | import sys | ||||||
| import unittest | import unittest | ||||||
| import warnings |  | ||||||
| import encodings | import encodings | ||||||
| 
 | 
 | ||||||
| from test import support | from test import support | ||||||
|  |  | ||||||
|  | @ -6,7 +6,7 @@ | ||||||
| # rip off all interesting stuff from test_profile | # rip off all interesting stuff from test_profile | ||||||
| import cProfile | import cProfile | ||||||
| from test.test_profile import ProfileTest, regenerate_expected_output | from test.test_profile import ProfileTest, regenerate_expected_output | ||||||
| from test.profilee import testfunc | 
 | ||||||
| 
 | 
 | ||||||
| class CProfileTest(ProfileTest): | class CProfileTest(ProfileTest): | ||||||
|     profilerclass = cProfile.Profile |     profilerclass = cProfile.Profile | ||||||
|  |  | ||||||
|  | @ -2,7 +2,6 @@ | ||||||
| # csv package unit tests | # csv package unit tests | ||||||
| 
 | 
 | ||||||
| import copy | import copy | ||||||
| import io |  | ||||||
| import sys | import sys | ||||||
| import unittest | import unittest | ||||||
| from io import StringIO | from io import StringIO | ||||||
|  | @ -1078,7 +1077,6 @@ class TestUnicode(unittest.TestCase): | ||||||
|              "François Pinard"] |              "François Pinard"] | ||||||
| 
 | 
 | ||||||
|     def test_unicode_read(self): |     def test_unicode_read(self): | ||||||
|         import io |  | ||||||
|         with TemporaryFile("w+", newline='', encoding="utf-8") as fileobj: |         with TemporaryFile("w+", newline='', encoding="utf-8") as fileobj: | ||||||
|             fileobj.write(",".join(self.names) + "\r\n") |             fileobj.write(",".join(self.names) + "\r\n") | ||||||
|             fileobj.seek(0) |             fileobj.seek(0) | ||||||
|  | @ -1087,7 +1085,6 @@ def test_unicode_read(self): | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|     def test_unicode_write(self): |     def test_unicode_write(self): | ||||||
|         import io |  | ||||||
|         with TemporaryFile("w+", newline='', encoding="utf-8") as fileobj: |         with TemporaryFile("w+", newline='', encoding="utf-8") as fileobj: | ||||||
|             writer = csv.writer(fileobj) |             writer = csv.writer(fileobj) | ||||||
|             writer.writerow(self.names) |             writer.writerow(self.names) | ||||||
|  |  | ||||||
|  | @ -2,7 +2,7 @@ | ||||||
| gdbm = support.import_module("dbm.gnu") #skip if not supported | gdbm = support.import_module("dbm.gnu") #skip if not supported | ||||||
| import unittest | import unittest | ||||||
| import os | import os | ||||||
| from test.support import verbose, TESTFN, unlink | from test.support import TESTFN, unlink | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| filename = TESTFN | filename = TESTFN | ||||||
|  |  | ||||||
|  | @ -1,7 +1,6 @@ | ||||||
| from test import support | from test import support | ||||||
| support.import_module("dbm.ndbm") #skip if not supported | support.import_module("dbm.ndbm") #skip if not supported | ||||||
| import unittest | import unittest | ||||||
| import random |  | ||||||
| import dbm.ndbm | import dbm.ndbm | ||||||
| from dbm.ndbm import error | from dbm.ndbm import error | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -6,7 +6,7 @@ | ||||||
| import random | import random | ||||||
| import select | import select | ||||||
| import unittest | import unittest | ||||||
| from test.support import TESTFN, run_unittest, cpython_only | from test.support import run_unittest, cpython_only | ||||||
| 
 | 
 | ||||||
| if not hasattr(select, 'devpoll') : | if not hasattr(select, 'devpoll') : | ||||||
|     raise unittest.SkipTest('test works only on Solaris OS family') |     raise unittest.SkipTest('test works only on Solaris OS family') | ||||||
|  |  | ||||||
|  | @ -1876,7 +1876,6 @@ def test_pdb_set_trace(): | ||||||
|         To demonstrate this, we'll create a fake standard input that |         To demonstrate this, we'll create a fake standard input that | ||||||
|         captures our debugger input: |         captures our debugger input: | ||||||
| 
 | 
 | ||||||
|           >>> import tempfile |  | ||||||
|           >>> real_stdin = sys.stdin |           >>> real_stdin = sys.stdin | ||||||
|           >>> sys.stdin = _FakeInput([ |           >>> sys.stdin = _FakeInput([ | ||||||
|           ...    'print(x)',  # print data defined by the example |           ...    'print(x)',  # print data defined by the example | ||||||
|  | @ -1917,7 +1916,7 @@ def test_pdb_set_trace(): | ||||||
|           ... finally: |           ... finally: | ||||||
|           ...     sys.stdin = real_stdin |           ...     sys.stdin = real_stdin | ||||||
|           --Return-- |           --Return-- | ||||||
|           > <doctest test.test_doctest.test_pdb_set_trace[8]>(3)calls_set_trace()->None |           > <doctest test.test_doctest.test_pdb_set_trace[7]>(3)calls_set_trace()->None | ||||||
|           -> import pdb; pdb.set_trace() |           -> import pdb; pdb.set_trace() | ||||||
|           (Pdb) print(y) |           (Pdb) print(y) | ||||||
|           2 |           2 | ||||||
|  | @ -2804,7 +2803,6 @@ def test_CLI(): r""" | ||||||
|     ...         _ = f.write("       'abc def'\n") |     ...         _ = f.write("       'abc def'\n") | ||||||
|     ...         _ = f.write("\n") |     ...         _ = f.write("\n") | ||||||
|     ...         _ = f.write('   \"\"\"\n') |     ...         _ = f.write('   \"\"\"\n') | ||||||
|     ...     import shutil |  | ||||||
|     ...     rc1, out1, err1 = script_helper.assert_python_failure( |     ...     rc1, out1, err1 = script_helper.assert_python_failure( | ||||||
|     ...             '-m', 'doctest', fn, fn2, TERM='') |     ...             '-m', 'doctest', fn, fn2, TERM='') | ||||||
|     ...     rc2, out2, err2 = script_helper.assert_python_ok( |     ...     rc2, out2, err2 = script_helper.assert_python_ok( | ||||||
|  |  | ||||||
|  | @ -1,7 +1,6 @@ | ||||||
| # Test the most dynamic corner cases of Python's runtime semantics. | # Test the most dynamic corner cases of Python's runtime semantics. | ||||||
| 
 | 
 | ||||||
| import builtins | import builtins | ||||||
| import contextlib |  | ||||||
| import unittest | import unittest | ||||||
| 
 | 
 | ||||||
| from test.support import swap_item, swap_attr | from test.support import swap_item, swap_attr | ||||||
|  |  | ||||||
|  | @ -3421,7 +3421,6 @@ def test_push_random(self): | ||||||
| class TestFeedParsers(TestEmailBase): | class TestFeedParsers(TestEmailBase): | ||||||
| 
 | 
 | ||||||
|     def parse(self, chunks): |     def parse(self, chunks): | ||||||
|         from email.feedparser import FeedParser |  | ||||||
|         feedparser = FeedParser() |         feedparser = FeedParser() | ||||||
|         for chunk in chunks: |         for chunk in chunks: | ||||||
|             feedparser.feed(chunk) |             feedparser.feed(chunk) | ||||||
|  |  | ||||||
|  | @ -1,7 +1,6 @@ | ||||||
| import datetime | import datetime | ||||||
| import textwrap | import textwrap | ||||||
| import unittest | import unittest | ||||||
| import types |  | ||||||
| from email import errors | from email import errors | ||||||
| from email import policy | from email import policy | ||||||
| from email.message import Message | from email.message import Message | ||||||
|  |  | ||||||
|  | @ -1,6 +1,5 @@ | ||||||
| 
 | 
 | ||||||
| import fractions | import fractions | ||||||
| import math |  | ||||||
| import operator | import operator | ||||||
| import os | import os | ||||||
| import random | import random | ||||||
|  |  | ||||||
|  | @ -5,7 +5,6 @@ | ||||||
| 
 | 
 | ||||||
| import os | import os | ||||||
| import re | import re | ||||||
| import pprint |  | ||||||
| import subprocess | import subprocess | ||||||
| import sys | import sys | ||||||
| import sysconfig | import sysconfig | ||||||
|  |  | ||||||
|  | @ -1,6 +1,5 @@ | ||||||
| import os | import os | ||||||
| import base64 | import base64 | ||||||
| import shutil |  | ||||||
| import gettext | import gettext | ||||||
| import unittest | import unittest | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,5 +1,4 @@ | ||||||
| import unittest | import unittest | ||||||
| from test import support |  | ||||||
| from test.support import import_module | from test.support import import_module | ||||||
| 
 | 
 | ||||||
| # Skip test if _thread or _tkinter wasn't built or idlelib was deleted. | # Skip test if _thread or _tkinter wasn't built or idlelib was deleted. | ||||||
|  |  | ||||||
|  | @ -2,7 +2,6 @@ | ||||||
| 
 | 
 | ||||||
| machinery = util.import_importlib('importlib.machinery') | machinery = util.import_importlib('importlib.machinery') | ||||||
| 
 | 
 | ||||||
| import collections |  | ||||||
| import unittest | import unittest | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,7 +1,6 @@ | ||||||
| from .. import util | from .. import util | ||||||
| import sys | import sys | ||||||
| import unittest | import unittest | ||||||
| import importlib |  | ||||||
| from test import support | from test import support | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -3,7 +3,6 @@ | ||||||
| init = test_util.import_importlib('importlib') | init = test_util.import_importlib('importlib') | ||||||
| 
 | 
 | ||||||
| import sys | import sys | ||||||
| import time |  | ||||||
| import unittest | import unittest | ||||||
| import weakref | import weakref | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,9 +1,6 @@ | ||||||
| import contextlib | import contextlib | ||||||
| import importlib.abc |  | ||||||
| import importlib.machinery |  | ||||||
| import os | import os | ||||||
| import sys | import sys | ||||||
| import types |  | ||||||
| import unittest | import unittest | ||||||
| 
 | 
 | ||||||
| from test.test_importlib import util | from test.test_importlib import util | ||||||
|  |  | ||||||
|  | @ -7,17 +7,12 @@ | ||||||
| import email.message | import email.message | ||||||
| import re | import re | ||||||
| import io | import io | ||||||
| import shutil |  | ||||||
| import tempfile | import tempfile | ||||||
| from test import support | from test import support | ||||||
| import unittest | import unittest | ||||||
| import textwrap | import textwrap | ||||||
| import mailbox | import mailbox | ||||||
| import glob | import glob | ||||||
| try: |  | ||||||
|     import fcntl |  | ||||||
| except ImportError: |  | ||||||
|     pass |  | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| class TestBase: | class TestBase: | ||||||
|  |  | ||||||
|  | @ -1,6 +1,5 @@ | ||||||
| import mailcap | import mailcap | ||||||
| import os | import os | ||||||
| import shutil |  | ||||||
| import test.support | import test.support | ||||||
| import unittest | import unittest | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -6,7 +6,6 @@ | ||||||
| import unittest | import unittest | ||||||
| import math | import math | ||||||
| import os | import os | ||||||
| import platform |  | ||||||
| import sys | import sys | ||||||
| import struct | import struct | ||||||
| import sysconfig | import sysconfig | ||||||
|  |  | ||||||
|  | @ -6,7 +6,6 @@ | ||||||
| 
 | 
 | ||||||
| import importlib | import importlib | ||||||
| import importlib.machinery | import importlib.machinery | ||||||
| import zipimport |  | ||||||
| import unittest | import unittest | ||||||
| import sys | import sys | ||||||
| import os | import os | ||||||
|  | @ -15,7 +14,7 @@ | ||||||
| 
 | 
 | ||||||
| from test.support.script_helper import ( | from test.support.script_helper import ( | ||||||
|     make_pkg, make_script, make_zip_pkg, make_zip_script, |     make_pkg, make_script, make_zip_pkg, make_zip_script, | ||||||
|     assert_python_ok, assert_python_failure, spawn_python, kill_python) |     assert_python_ok) | ||||||
| 
 | 
 | ||||||
| # Look up which start methods are available to test | # Look up which start methods are available to test | ||||||
| import multiprocessing | import multiprocessing | ||||||
|  |  | ||||||
|  | @ -558,7 +558,6 @@ def test_pdb_continue_in_bottomframe(): | ||||||
| 
 | 
 | ||||||
| def pdb_invoke(method, arg): | def pdb_invoke(method, arg): | ||||||
|     """Run pdb.method(arg).""" |     """Run pdb.method(arg).""" | ||||||
|     import pdb |  | ||||||
|     getattr(pdb.Pdb(nosigint=True), method)(arg) |     getattr(pdb.Pdb(nosigint=True), method)(arg) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,6 +1,5 @@ | ||||||
| import unittest | import unittest | ||||||
| import builtins | import builtins | ||||||
| import warnings |  | ||||||
| import os | import os | ||||||
| from platform import system as platform_system | from platform import system as platform_system | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,4 +1,3 @@ | ||||||
| import struct |  | ||||||
| import pickle | import pickle | ||||||
| import pickletools | import pickletools | ||||||
| from test import support | from test import support | ||||||
|  |  | ||||||
|  | @ -7,7 +7,6 @@ | ||||||
| import codecs | import codecs | ||||||
| import binascii | import binascii | ||||||
| import collections | import collections | ||||||
| import struct |  | ||||||
| from test import support | from test import support | ||||||
| from io import BytesIO | from io import BytesIO | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -8,7 +8,6 @@ | ||||||
| import asynchat | import asynchat | ||||||
| import socket | import socket | ||||||
| import os | import os | ||||||
| import time |  | ||||||
| import errno | import errno | ||||||
| 
 | 
 | ||||||
| from unittest import TestCase, skipUnless | from unittest import TestCase, skipUnless | ||||||
|  |  | ||||||
|  | @ -11,7 +11,6 @@ | ||||||
| import os | import os | ||||||
| import platform | import platform | ||||||
| import pwd | import pwd | ||||||
| import shutil |  | ||||||
| import stat | import stat | ||||||
| import tempfile | import tempfile | ||||||
| import unittest | import unittest | ||||||
|  |  | ||||||
|  | @ -1,4 +1,3 @@ | ||||||
| import itertools |  | ||||||
| import os | import os | ||||||
| import posixpath | import posixpath | ||||||
| import unittest | import unittest | ||||||
|  |  | ||||||
|  | @ -4,10 +4,8 @@ | ||||||
| Note: test_regrtest cannot be run twice in parallel. | Note: test_regrtest cannot be run twice in parallel. | ||||||
| """ | """ | ||||||
| 
 | 
 | ||||||
| import argparse |  | ||||||
| import contextlib | import contextlib | ||||||
| import faulthandler | import faulthandler | ||||||
| import getopt |  | ||||||
| import io | import io | ||||||
| import os.path | import os.path | ||||||
| import platform | import platform | ||||||
|  |  | ||||||
|  | @ -2,8 +2,6 @@ | ||||||
| import unittest | import unittest | ||||||
| import urllib.robotparser | import urllib.robotparser | ||||||
| from collections import namedtuple | from collections import namedtuple | ||||||
| from urllib.error import URLError, HTTPError |  | ||||||
| from urllib.request import urlopen |  | ||||||
| from test import support | from test import support | ||||||
| from http.server import BaseHTTPRequestHandler, HTTPServer | from http.server import BaseHTTPRequestHandler, HTTPServer | ||||||
| try: | try: | ||||||
|  |  | ||||||
|  | @ -13,7 +13,6 @@ | ||||||
| import sys | import sys | ||||||
| import os | import os | ||||||
| import array | import array | ||||||
| import platform |  | ||||||
| import contextlib | import contextlib | ||||||
| from weakref import proxy | from weakref import proxy | ||||||
| import signal | import signal | ||||||
|  |  | ||||||
|  | @ -7,8 +7,6 @@ | ||||||
| import select | import select | ||||||
| import signal | import signal | ||||||
| import socket | import socket | ||||||
| import select |  | ||||||
| import errno |  | ||||||
| import tempfile | import tempfile | ||||||
| import unittest | import unittest | ||||||
| import socketserver | import socketserver | ||||||
|  |  | ||||||
|  | @ -5,15 +5,12 @@ | ||||||
| import sys | import sys | ||||||
| import signal | import signal | ||||||
| import io | import io | ||||||
| import locale |  | ||||||
| import os | import os | ||||||
| import errno | import errno | ||||||
| import tempfile | import tempfile | ||||||
| import time | import time | ||||||
| import re |  | ||||||
| import selectors | import selectors | ||||||
| import sysconfig | import sysconfig | ||||||
| import warnings |  | ||||||
| import select | import select | ||||||
| import shutil | import shutil | ||||||
| import gc | import gc | ||||||
|  |  | ||||||
|  | @ -1,4 +1,3 @@ | ||||||
| from test.support import TESTFN |  | ||||||
| import unittest | import unittest | ||||||
| from test import audiotests | from test import audiotests | ||||||
| from audioop import byteswap | from audioop import byteswap | ||||||
|  |  | ||||||
|  | @ -1,7 +1,6 @@ | ||||||
| import socket | import socket | ||||||
| import selectors | import selectors | ||||||
| import telnetlib | import telnetlib | ||||||
| import time |  | ||||||
| import contextlib | import contextlib | ||||||
| 
 | 
 | ||||||
| from test import support | from test import support | ||||||
|  |  | ||||||
|  | @ -3,7 +3,7 @@ | ||||||
| """ | """ | ||||||
| 
 | 
 | ||||||
| import test.support | import test.support | ||||||
| from test.support import verbose, strip_python_stderr, import_module, cpython_only | from test.support import verbose, import_module, cpython_only | ||||||
| from test.support.script_helper import assert_python_ok, assert_python_failure | from test.support.script_helper import assert_python_ok, assert_python_failure | ||||||
| 
 | 
 | ||||||
| import random | import random | ||||||
|  |  | ||||||
|  | @ -2,12 +2,11 @@ | ||||||
| 
 | 
 | ||||||
| import os | import os | ||||||
| import sys | import sys | ||||||
| import importlib |  | ||||||
| import unittest | import unittest | ||||||
| from unittest import mock | from unittest import mock | ||||||
| import tempfile | import tempfile | ||||||
| 
 | 
 | ||||||
| from test.test_tools import scriptsdir, skip_if_missing, import_tool | from test.test_tools import skip_if_missing, import_tool | ||||||
| 
 | 
 | ||||||
| skip_if_missing() | skip_if_missing() | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -5,7 +5,7 @@ | ||||||
| from test import support | from test import support | ||||||
| from test.support.script_helper import assert_python_ok, assert_python_failure | from test.support.script_helper import assert_python_ok, assert_python_failure | ||||||
| 
 | 
 | ||||||
| from test.test_tools import scriptsdir, import_tool, skip_if_missing | from test.test_tools import scriptsdir, skip_if_missing | ||||||
| 
 | 
 | ||||||
| skip_if_missing() | skip_if_missing() | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -4,7 +4,7 @@ | ||||||
| import unittest | import unittest | ||||||
| import tempfile | import tempfile | ||||||
| 
 | 
 | ||||||
| from test.test_tools import scriptsdir, skip_if_missing, import_tool | from test.test_tools import skip_if_missing, import_tool | ||||||
| 
 | 
 | ||||||
| skip_if_missing() | skip_if_missing() | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -462,7 +462,7 @@ def reset(self): | ||||||
|         self.requests = [] |         self.requests = [] | ||||||
| 
 | 
 | ||||||
|     def http_open(self, req): |     def http_open(self, req): | ||||||
|         import email, http.client, copy |         import email, copy | ||||||
|         self.requests.append(copy.deepcopy(req)) |         self.requests.append(copy.deepcopy(req)) | ||||||
|         if self._count == 0: |         if self._count == 0: | ||||||
|             self._count = self._count + 1 |             self._count = self._count + 1 | ||||||
|  |  | ||||||
|  | @ -1,7 +1,6 @@ | ||||||
| # UserString is a wrapper around the native builtin string type. | # UserString is a wrapper around the native builtin string type. | ||||||
| # UserString instances should behave similar to builtin string objects. | # UserString instances should behave similar to builtin string objects. | ||||||
| 
 | 
 | ||||||
| import string |  | ||||||
| import unittest | import unittest | ||||||
| from test import string_tests | from test import string_tests | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -8,7 +8,6 @@ | ||||||
| 
 | 
 | ||||||
| import sys, os | import sys, os | ||||||
| import uu | import uu | ||||||
| from io import BytesIO |  | ||||||
| import io | import io | ||||||
| 
 | 
 | ||||||
| plaintext = b"The smooth-scaled python crept over the sleeping dog\n" | plaintext = b"The smooth-scaled python crept over the sleeping dog\n" | ||||||
|  |  | ||||||
|  | @ -15,7 +15,6 @@ | ||||||
| import tempfile | import tempfile | ||||||
| from test.support import (captured_stdout, captured_stderr, | from test.support import (captured_stdout, captured_stderr, | ||||||
|                           can_symlink, EnvironmentVarGuard, rmtree) |                           can_symlink, EnvironmentVarGuard, rmtree) | ||||||
| import textwrap |  | ||||||
| import unittest | import unittest | ||||||
| import venv | import venv | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,4 +1,3 @@ | ||||||
| from test.support import TESTFN |  | ||||||
| import unittest | import unittest | ||||||
| from test import audiotests | from test import audiotests | ||||||
| from test import support | from test import support | ||||||
|  |  | ||||||
|  | @ -1,11 +1,6 @@ | ||||||
| import unittest | import unittest | ||||||
| from weakref import proxy, ref, WeakSet | from weakref import WeakSet | ||||||
| import operator |  | ||||||
| import copy |  | ||||||
| import string | import string | ||||||
| from random import randrange, shuffle |  | ||||||
| import warnings |  | ||||||
| import collections |  | ||||||
| from collections import UserString as ustr | from collections import UserString as ustr | ||||||
| import gc | import gc | ||||||
| import contextlib | import contextlib | ||||||
|  |  | ||||||
|  | @ -108,7 +108,7 @@ def test_element_with_children(self): | ||||||
|                              struct.calcsize('8P')) |                              struct.calcsize('8P')) | ||||||
| 
 | 
 | ||||||
| def test_main(): | def test_main(): | ||||||
|     from test import test_xml_etree, test_xml_etree_c |     from test import test_xml_etree | ||||||
| 
 | 
 | ||||||
|     # Run the tests specific to the C implementation |     # Run the tests specific to the C implementation | ||||||
|     support.run_unittest( |     support.run_unittest( | ||||||
|  |  | ||||||
|  | @ -1132,7 +1132,6 @@ def captured_stdout(encoding='utf-8'): | ||||||
|     """A variation on support.captured_stdout() which gives a text stream |     """A variation on support.captured_stdout() which gives a text stream | ||||||
|     having a `buffer` attribute. |     having a `buffer` attribute. | ||||||
|     """ |     """ | ||||||
|     import io |  | ||||||
|     orig_stdout = sys.stdout |     orig_stdout = sys.stdout | ||||||
|     sys.stdout = io.TextIOWrapper(io.BytesIO(), encoding=encoding) |     sys.stdout = io.TextIOWrapper(io.BytesIO(), encoding=encoding) | ||||||
|     try: |     try: | ||||||
|  |  | ||||||
|  | @ -1,6 +1,4 @@ | ||||||
| import collections.abc | import collections.abc | ||||||
| import errno |  | ||||||
| import socket |  | ||||||
| import unittest | import unittest | ||||||
| from test import support | from test import support | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -12,7 +12,6 @@ | ||||||
| import doctest | import doctest | ||||||
| import inspect | import inspect | ||||||
| import linecache | import linecache | ||||||
| import pdb |  | ||||||
| import unittest | import unittest | ||||||
| from test.support.script_helper import (spawn_python, kill_python, assert_python_ok, | from test.support.script_helper import (spawn_python, kill_python, assert_python_ok, | ||||||
|                                         make_script, make_zip_script) |                                         make_script, make_zip_script) | ||||||
|  |  | ||||||
|  | @ -7,7 +7,6 @@ | ||||||
| """ | """ | ||||||
| 
 | 
 | ||||||
| import os | import os | ||||||
| import unittest |  | ||||||
| import importlib | import importlib | ||||||
| import test.support | import test.support | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,6 +1,5 @@ | ||||||
| # -*- encoding: utf-8 -*- | # -*- encoding: utf-8 -*- | ||||||
| import unittest | import unittest | ||||||
| import tkinter |  | ||||||
| from tkinter import ttk | from tkinter import ttk | ||||||
| 
 | 
 | ||||||
| class MockTkApp: | class MockTkApp: | ||||||
|  |  | ||||||
|  | @ -1,5 +1,4 @@ | ||||||
| import unittest | import unittest | ||||||
| import inspect |  | ||||||
| import sys | import sys | ||||||
| from unittest.mock import Mock, MagicMock, _magics | from unittest.mock import Mock, MagicMock, _magics | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -10,9 +10,9 @@ | ||||||
| from unittest.test.testmock.support import SomeClass, is_instance | from unittest.test.testmock.support import SomeClass, is_instance | ||||||
| 
 | 
 | ||||||
| from unittest.mock import ( | from unittest.mock import ( | ||||||
|     NonCallableMock, CallableMixin, patch, sentinel, |     NonCallableMock, CallableMixin, sentinel, | ||||||
|     MagicMock, Mock, NonCallableMagicMock, patch, _patch, |     MagicMock, Mock, NonCallableMagicMock, patch, _patch, | ||||||
|     DEFAULT, call, _get_target, _patch |     DEFAULT, call, _get_target | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Serhiy Storchaka
						Serhiy Storchaka