[Python-checkins] cpython: Issue #23277: Remove unused sys and os imports

berker.peksag python-checkins at python.org
Sun Apr 24 00:31:27 EDT 2016


https://hg.python.org/cpython/rev/6958bbf7f0ec
changeset:   101118:6958bbf7f0ec
user:        Berker Peksag <berker.peksag at gmail.com>
date:        Sun Apr 24 07:31:42 2016 +0300
summary:
  Issue #23277: Remove unused sys and os imports

Patch by Jon Dufresne.

files:
  Lib/ctypes/test/test_objects.py                            |  2 +-
  Lib/ctypes/test/test_parameters.py                         |  2 +-
  Lib/ctypes/test/test_returnfuncptrs.py                     |  1 -
  Lib/ctypes/test/test_sizes.py                              |  1 -
  Lib/test/audiotests.py                                     |  2 +-
  Lib/test/make_ssl_certs.py                                 |  1 -
  Lib/test/test_aifc.py                                      |  1 -
  Lib/test/test_binhex.py                                    |  1 -
  Lib/test/test_csv.py                                       |  1 -
  Lib/test/test_dbm.py                                       |  1 -
  Lib/test/test_dbm_ndbm.py                                  |  1 -
  Lib/test/test_devpoll.py                                   |  1 -
  Lib/test/test_eintr.py                                     |  1 -
  Lib/test/test_email/__init__.py                            |  1 -
  Lib/test/test_heapq.py                                     |  1 -
  Lib/test/test_importlib/extension/test_case_sensitivity.py |  1 -
  Lib/test/test_importlib/extension/test_path_hook.py        |  1 -
  Lib/test/test_importlib/frozen/test_loader.py              |  2 --
  Lib/test/test_importlib/import_/test_relative_imports.py   |  1 -
  Lib/test/test_importlib/source/test_case_sensitivity.py    |  1 -
  Lib/test/test_json/__init__.py                             |  1 -
  Lib/test/test_kqueue.py                                    |  1 -
  Lib/test/test_msilib.py                                    |  1 -
  Lib/test/test_multibytecodec.py                            |  2 +-
  Lib/test/test_nis.py                                       |  1 -
  Lib/test/test_normalization.py                             |  1 -
  Lib/test/test_parser.py                                    |  1 -
  Lib/test/test_pep3151.py                                   |  1 -
  Lib/test/test_posixpath.py                                 |  1 -
  Lib/test/test_pulldom.py                                   |  1 -
  Lib/test/test_quopri.py                                    |  2 +-
  Lib/test/test_sort.py                                      |  1 -
  Lib/test/test_strptime.py                                  |  1 -
  Lib/test/test_tools/test_md5sum.py                         |  1 -
  Lib/test/test_tools/test_pdeps.py                          |  1 -
  Lib/test/test_ttk_guionly.py                               |  1 -
  Lib/test/test_ttk_textonly.py                              |  1 -
  Lib/test/test_unpack_ex.py                                 |  1 -
  Lib/test/test_urllibnet.py                                 |  1 -
  Lib/test/test_weakset.py                                   |  2 --
  Lib/test/test_xml_etree_c.py                               |  2 +-
  Lib/test/test_xmlrpc_net.py                                |  1 -
  Lib/test/test_zipfile.py                                   |  1 -
  Lib/tkinter/test/runtktests.py                             |  1 -
  Lib/unittest/test/testmock/support.py                      |  2 --
  45 files changed, 6 insertions(+), 48 deletions(-)


diff --git a/Lib/ctypes/test/test_objects.py b/Lib/ctypes/test/test_objects.py
--- a/Lib/ctypes/test/test_objects.py
+++ b/Lib/ctypes/test/test_objects.py
@@ -54,7 +54,7 @@
 
 '''
 
-import unittest, doctest, sys
+import unittest, doctest
 
 import ctypes.test.test_objects
 
diff --git a/Lib/ctypes/test/test_parameters.py b/Lib/ctypes/test/test_parameters.py
--- a/Lib/ctypes/test/test_parameters.py
+++ b/Lib/ctypes/test/test_parameters.py
@@ -1,4 +1,4 @@
-import unittest, sys
+import unittest
 from ctypes.test import need_symbol
 
 class SimpleTypesTestCase(unittest.TestCase):
diff --git a/Lib/ctypes/test/test_returnfuncptrs.py b/Lib/ctypes/test/test_returnfuncptrs.py
--- a/Lib/ctypes/test/test_returnfuncptrs.py
+++ b/Lib/ctypes/test/test_returnfuncptrs.py
@@ -1,6 +1,5 @@
 import unittest
 from ctypes import *
-import os
 
 import _ctypes_test
 
diff --git a/Lib/ctypes/test/test_sizes.py b/Lib/ctypes/test/test_sizes.py
--- a/Lib/ctypes/test/test_sizes.py
+++ b/Lib/ctypes/test/test_sizes.py
@@ -2,7 +2,6 @@
 
 from ctypes import *
 
-import sys
 import unittest
 
 
diff --git a/Lib/test/audiotests.py b/Lib/test/audiotests.py
--- a/Lib/test/audiotests.py
+++ b/Lib/test/audiotests.py
@@ -3,7 +3,7 @@
 import array
 import io
 import pickle
-import sys
+
 
 class UnseekableIO(io.FileIO):
     def tell(self):
diff --git a/Lib/test/make_ssl_certs.py b/Lib/test/make_ssl_certs.py
--- a/Lib/test/make_ssl_certs.py
+++ b/Lib/test/make_ssl_certs.py
@@ -3,7 +3,6 @@
 
 import os
 import shutil
-import sys
 import tempfile
 from subprocess import *
 
diff --git a/Lib/test/test_aifc.py b/Lib/test/test_aifc.py
--- a/Lib/test/test_aifc.py
+++ b/Lib/test/test_aifc.py
@@ -2,7 +2,6 @@
 import unittest
 from test import audiotests
 from audioop import byteswap
-import os
 import io
 import sys
 import struct
diff --git a/Lib/test/test_binhex.py b/Lib/test/test_binhex.py
--- a/Lib/test/test_binhex.py
+++ b/Lib/test/test_binhex.py
@@ -4,7 +4,6 @@
    Based on an original test by Roger E. Masse.
 """
 import binhex
-import os
 import unittest
 from test import support
 
diff --git a/Lib/test/test_csv.py b/Lib/test/test_csv.py
--- a/Lib/test/test_csv.py
+++ b/Lib/test/test_csv.py
@@ -4,7 +4,6 @@
 import copy
 import io
 import sys
-import os
 import unittest
 from io import StringIO
 from tempfile import TemporaryFile
diff --git a/Lib/test/test_dbm.py b/Lib/test/test_dbm.py
--- a/Lib/test/test_dbm.py
+++ b/Lib/test/test_dbm.py
@@ -1,6 +1,5 @@
 """Test script for the dbm.open function based on testdumbdbm.py"""
 
-import os
 import unittest
 import glob
 import test.support
diff --git a/Lib/test/test_dbm_ndbm.py b/Lib/test/test_dbm_ndbm.py
--- a/Lib/test/test_dbm_ndbm.py
+++ b/Lib/test/test_dbm_ndbm.py
@@ -1,7 +1,6 @@
 from test import support
 support.import_module("dbm.ndbm") #skip if not supported
 import unittest
-import os
 import random
 import dbm.ndbm
 from dbm.ndbm import error
diff --git a/Lib/test/test_devpoll.py b/Lib/test/test_devpoll.py
--- a/Lib/test/test_devpoll.py
+++ b/Lib/test/test_devpoll.py
@@ -5,7 +5,6 @@
 import os
 import random
 import select
-import sys
 import unittest
 from test.support import TESTFN, run_unittest, cpython_only
 
diff --git a/Lib/test/test_eintr.py b/Lib/test/test_eintr.py
--- a/Lib/test/test_eintr.py
+++ b/Lib/test/test_eintr.py
@@ -1,7 +1,6 @@
 import os
 import signal
 import subprocess
-import sys
 import unittest
 
 from test import support
diff --git a/Lib/test/test_email/__init__.py b/Lib/test/test_email/__init__.py
--- a/Lib/test/test_email/__init__.py
+++ b/Lib/test/test_email/__init__.py
@@ -1,5 +1,4 @@
 import os
-import sys
 import unittest
 import collections
 import email
diff --git a/Lib/test/test_heapq.py b/Lib/test/test_heapq.py
--- a/Lib/test/test_heapq.py
+++ b/Lib/test/test_heapq.py
@@ -1,6 +1,5 @@
 """Unittests for heapq."""
 
-import sys
 import random
 import unittest
 
diff --git a/Lib/test/test_importlib/extension/test_case_sensitivity.py b/Lib/test/test_importlib/extension/test_case_sensitivity.py
--- a/Lib/test/test_importlib/extension/test_case_sensitivity.py
+++ b/Lib/test/test_importlib/extension/test_case_sensitivity.py
@@ -1,5 +1,4 @@
 from importlib import _bootstrap_external
-import sys
 from test import support
 import unittest
 
diff --git a/Lib/test/test_importlib/extension/test_path_hook.py b/Lib/test/test_importlib/extension/test_path_hook.py
--- a/Lib/test/test_importlib/extension/test_path_hook.py
+++ b/Lib/test/test_importlib/extension/test_path_hook.py
@@ -3,7 +3,6 @@
 machinery = util.import_importlib('importlib.machinery')
 
 import collections
-import sys
 import unittest
 
 
diff --git a/Lib/test/test_importlib/frozen/test_loader.py b/Lib/test/test_importlib/frozen/test_loader.py
--- a/Lib/test/test_importlib/frozen/test_loader.py
+++ b/Lib/test/test_importlib/frozen/test_loader.py
@@ -3,8 +3,6 @@
 
 machinery = util.import_importlib('importlib.machinery')
 
-
-import sys
 from test.support import captured_stdout
 import types
 import unittest
diff --git a/Lib/test/test_importlib/import_/test_relative_imports.py b/Lib/test/test_importlib/import_/test_relative_imports.py
--- a/Lib/test/test_importlib/import_/test_relative_imports.py
+++ b/Lib/test/test_importlib/import_/test_relative_imports.py
@@ -1,6 +1,5 @@
 """Test relative imports (PEP 328)."""
 from .. import util
-import sys
 import unittest
 import warnings
 
diff --git a/Lib/test/test_importlib/source/test_case_sensitivity.py b/Lib/test/test_importlib/source/test_case_sensitivity.py
--- a/Lib/test/test_importlib/source/test_case_sensitivity.py
+++ b/Lib/test/test_importlib/source/test_case_sensitivity.py
@@ -5,7 +5,6 @@
 machinery = util.import_importlib('importlib.machinery')
 
 import os
-import sys
 from test import support as test_support
 import unittest
 
diff --git a/Lib/test/test_json/__init__.py b/Lib/test/test_json/__init__.py
--- a/Lib/test/test_json/__init__.py
+++ b/Lib/test/test_json/__init__.py
@@ -1,5 +1,4 @@
 import os
-import sys
 import json
 import doctest
 import unittest
diff --git a/Lib/test/test_kqueue.py b/Lib/test/test_kqueue.py
--- a/Lib/test/test_kqueue.py
+++ b/Lib/test/test_kqueue.py
@@ -5,7 +5,6 @@
 import os
 import select
 import socket
-import sys
 import time
 import unittest
 
diff --git a/Lib/test/test_msilib.py b/Lib/test/test_msilib.py
--- a/Lib/test/test_msilib.py
+++ b/Lib/test/test_msilib.py
@@ -1,6 +1,5 @@
 """ Test suite for the code in msilib """
 import unittest
-import os
 from test.support import import_module
 msilib = import_module('msilib')
 
diff --git a/Lib/test/test_multibytecodec.py b/Lib/test/test_multibytecodec.py
--- a/Lib/test/test_multibytecodec.py
+++ b/Lib/test/test_multibytecodec.py
@@ -5,7 +5,7 @@
 
 from test import support
 from test.support import TESTFN
-import unittest, io, codecs, sys, os
+import unittest, io, codecs, sys
 import _multibytecodec
 
 ALL_CJKENCODINGS = [
diff --git a/Lib/test/test_nis.py b/Lib/test/test_nis.py
--- a/Lib/test/test_nis.py
+++ b/Lib/test/test_nis.py
@@ -1,6 +1,5 @@
 from test import support
 import unittest
-import sys
 
 # Skip test if nis module does not exist.
 nis = support.import_module('nis')
diff --git a/Lib/test/test_normalization.py b/Lib/test/test_normalization.py
--- a/Lib/test/test_normalization.py
+++ b/Lib/test/test_normalization.py
@@ -3,7 +3,6 @@
 
 from http.client import HTTPException
 import sys
-import os
 from unicodedata import normalize, unidata_version
 
 TESTDATAFILE = "NormalizationTest.txt"
diff --git a/Lib/test/test_parser.py b/Lib/test/test_parser.py
--- a/Lib/test/test_parser.py
+++ b/Lib/test/test_parser.py
@@ -1,6 +1,5 @@
 import parser
 import unittest
-import sys
 import operator
 import struct
 from test import support
diff --git a/Lib/test/test_pep3151.py b/Lib/test/test_pep3151.py
--- a/Lib/test/test_pep3151.py
+++ b/Lib/test/test_pep3151.py
@@ -2,7 +2,6 @@
 import os
 import select
 import socket
-import sys
 import unittest
 import errno
 from errno import EEXIST
diff --git a/Lib/test/test_posixpath.py b/Lib/test/test_posixpath.py
--- a/Lib/test/test_posixpath.py
+++ b/Lib/test/test_posixpath.py
@@ -1,7 +1,6 @@
 import itertools
 import os
 import posixpath
-import sys
 import unittest
 import warnings
 from posixpath import realpath, abspath, dirname, basename
diff --git a/Lib/test/test_pulldom.py b/Lib/test/test_pulldom.py
--- a/Lib/test/test_pulldom.py
+++ b/Lib/test/test_pulldom.py
@@ -1,6 +1,5 @@
 import io
 import unittest
-import sys
 import xml.sax
 
 from xml.sax.xmlreader import AttributesImpl
diff --git a/Lib/test/test_quopri.py b/Lib/test/test_quopri.py
--- a/Lib/test/test_quopri.py
+++ b/Lib/test/test_quopri.py
@@ -1,6 +1,6 @@
 import unittest
 
-import sys, os, io, subprocess
+import sys, io, subprocess
 import quopri
 
 
diff --git a/Lib/test/test_sort.py b/Lib/test/test_sort.py
--- a/Lib/test/test_sort.py
+++ b/Lib/test/test_sort.py
@@ -1,6 +1,5 @@
 from test import support
 import random
-import sys
 import unittest
 from functools import cmp_to_key
 
diff --git a/Lib/test/test_strptime.py b/Lib/test/test_strptime.py
--- a/Lib/test/test_strptime.py
+++ b/Lib/test/test_strptime.py
@@ -5,7 +5,6 @@
 import locale
 import re
 import os
-import sys
 from test import support
 from datetime import date as datetime_date
 
diff --git a/Lib/test/test_tools/test_md5sum.py b/Lib/test/test_tools/test_md5sum.py
--- a/Lib/test/test_tools/test_md5sum.py
+++ b/Lib/test/test_tools/test_md5sum.py
@@ -1,7 +1,6 @@
 """Tests for the md5sum script in the Tools directory."""
 
 import os
-import sys
 import unittest
 from test import support
 from test.support.script_helper import assert_python_ok, assert_python_failure
diff --git a/Lib/test/test_tools/test_pdeps.py b/Lib/test/test_tools/test_pdeps.py
--- a/Lib/test/test_tools/test_pdeps.py
+++ b/Lib/test/test_tools/test_pdeps.py
@@ -1,7 +1,6 @@
 """Tests for the pdeps script in the Tools directory."""
 
 import os
-import sys
 import unittest
 import tempfile
 from test import support
diff --git a/Lib/test/test_ttk_guionly.py b/Lib/test/test_ttk_guionly.py
--- a/Lib/test/test_ttk_guionly.py
+++ b/Lib/test/test_ttk_guionly.py
@@ -1,4 +1,3 @@
-import os
 import unittest
 from test import support
 
diff --git a/Lib/test/test_ttk_textonly.py b/Lib/test/test_ttk_textonly.py
--- a/Lib/test/test_ttk_textonly.py
+++ b/Lib/test/test_ttk_textonly.py
@@ -1,4 +1,3 @@
-import os
 from test import support
 
 # Skip this test if _tkinter does not exist.
diff --git a/Lib/test/test_unpack_ex.py b/Lib/test/test_unpack_ex.py
--- a/Lib/test/test_unpack_ex.py
+++ b/Lib/test/test_unpack_ex.py
@@ -352,7 +352,6 @@
 __test__ = {'doctests' : doctests}
 
 def test_main(verbose=False):
-    import sys
     from test import support
     from test import test_unpack_ex
     support.run_doctest(test_unpack_ex, verbose)
diff --git a/Lib/test/test_urllibnet.py b/Lib/test/test_urllibnet.py
--- a/Lib/test/test_urllibnet.py
+++ b/Lib/test/test_urllibnet.py
@@ -4,7 +4,6 @@
 import contextlib
 import socket
 import urllib.request
-import sys
 import os
 import email.message
 import time
diff --git a/Lib/test/test_weakset.py b/Lib/test/test_weakset.py
--- a/Lib/test/test_weakset.py
+++ b/Lib/test/test_weakset.py
@@ -3,9 +3,7 @@
 import operator
 import copy
 import string
-import os
 from random import randrange, shuffle
-import sys
 import warnings
 import collections
 from collections import UserString as ustr
diff --git a/Lib/test/test_xml_etree_c.py b/Lib/test/test_xml_etree_c.py
--- a/Lib/test/test_xml_etree_c.py
+++ b/Lib/test/test_xml_etree_c.py
@@ -1,5 +1,5 @@
 # xml.etree test for cElementTree
-import sys, struct
+import struct
 from test import support
 from test.support import import_fresh_module
 import types
diff --git a/Lib/test/test_xmlrpc_net.py b/Lib/test/test_xmlrpc_net.py
--- a/Lib/test/test_xmlrpc_net.py
+++ b/Lib/test/test_xmlrpc_net.py
@@ -1,7 +1,6 @@
 import collections.abc
 import errno
 import socket
-import sys
 import unittest
 from test import support
 
diff --git a/Lib/test/test_zipfile.py b/Lib/test/test_zipfile.py
--- a/Lib/test/test_zipfile.py
+++ b/Lib/test/test_zipfile.py
@@ -1,7 +1,6 @@
 import contextlib
 import io
 import os
-import sys
 import importlib.util
 import posixpath
 import time
diff --git a/Lib/tkinter/test/runtktests.py b/Lib/tkinter/test/runtktests.py
--- a/Lib/tkinter/test/runtktests.py
+++ b/Lib/tkinter/test/runtktests.py
@@ -7,7 +7,6 @@
 """
 
 import os
-import sys
 import unittest
 import importlib
 import test.support
diff --git a/Lib/unittest/test/testmock/support.py b/Lib/unittest/test/testmock/support.py
--- a/Lib/unittest/test/testmock/support.py
+++ b/Lib/unittest/test/testmock/support.py
@@ -1,5 +1,3 @@
-import sys
-
 def is_instance(obj, klass):
     """Version of is_instance that doesn't access __class__"""
     return issubclass(type(obj), klass)

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list