Commit 1e8ee9b3 authored by Berker Peksag's avatar Berker Peksag

Issue #23277: Remove unused sys and os imports

Patch by Jon Dufresne.
parent 37917369
...@@ -54,7 +54,7 @@ of 'x' ('_b_base_' is either None, or the root object owning the memory block): ...@@ -54,7 +54,7 @@ of 'x' ('_b_base_' is either None, or the root object owning the memory block):
''' '''
import unittest, doctest, sys import unittest, doctest
import ctypes.test.test_objects import ctypes.test.test_objects
......
import unittest, sys import unittest
from ctypes.test import need_symbol from ctypes.test import need_symbol
class SimpleTypesTestCase(unittest.TestCase): class SimpleTypesTestCase(unittest.TestCase):
......
import unittest import unittest
from ctypes import * from ctypes import *
import os
import _ctypes_test import _ctypes_test
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
from ctypes import * from ctypes import *
import sys
import unittest import unittest
......
...@@ -3,7 +3,7 @@ import unittest ...@@ -3,7 +3,7 @@ import unittest
import array import array
import io import io
import pickle import pickle
import sys
class UnseekableIO(io.FileIO): class UnseekableIO(io.FileIO):
def tell(self): def tell(self):
......
...@@ -3,7 +3,6 @@ and friends.""" ...@@ -3,7 +3,6 @@ and friends."""
import os import os
import shutil import shutil
import sys
import tempfile import tempfile
from subprocess import * from subprocess import *
......
...@@ -2,7 +2,6 @@ from test.support import findfile, TESTFN, unlink ...@@ -2,7 +2,6 @@ from test.support import findfile, TESTFN, unlink
import unittest import unittest
from test import audiotests from test import audiotests
from audioop import byteswap from audioop import byteswap
import os
import io import io
import sys import sys
import struct import struct
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
Based on an original test by Roger E. Masse. Based on an original test by Roger E. Masse.
""" """
import binhex import binhex
import os
import unittest import unittest
from test import support from test import support
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
import copy import copy
import io import io
import sys import sys
import os
import unittest import unittest
from io import StringIO from io import StringIO
from tempfile import TemporaryFile from tempfile import TemporaryFile
......
"""Test script for the dbm.open function based on testdumbdbm.py""" """Test script for the dbm.open function based on testdumbdbm.py"""
import os
import unittest import unittest
import glob import glob
import test.support import test.support
......
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 os
import random import random
import dbm.ndbm import dbm.ndbm
from dbm.ndbm import error from dbm.ndbm import error
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
import os import os
import random import random
import select import select
import sys
import unittest import unittest
from test.support import TESTFN, run_unittest, cpython_only from test.support import TESTFN, run_unittest, cpython_only
......
import os import os
import signal import signal
import subprocess import subprocess
import sys
import unittest import unittest
from test import support from test import support
......
import os import os
import sys
import unittest import unittest
import collections import collections
import email import email
......
"""Unittests for heapq.""" """Unittests for heapq."""
import sys
import random import random
import unittest import unittest
......
from importlib import _bootstrap_external from importlib import _bootstrap_external
import sys
from test import support from test import support
import unittest import unittest
......
...@@ -3,7 +3,6 @@ from .. import util ...@@ -3,7 +3,6 @@ from .. import util
machinery = util.import_importlib('importlib.machinery') machinery = util.import_importlib('importlib.machinery')
import collections import collections
import sys
import unittest import unittest
......
...@@ -3,8 +3,6 @@ from .. import util ...@@ -3,8 +3,6 @@ from .. import util
machinery = util.import_importlib('importlib.machinery') machinery = util.import_importlib('importlib.machinery')
import sys
from test.support import captured_stdout from test.support import captured_stdout
import types import types
import unittest import unittest
......
"""Test relative imports (PEP 328).""" """Test relative imports (PEP 328)."""
from .. import util from .. import util
import sys
import unittest import unittest
import warnings import warnings
......
...@@ -5,7 +5,6 @@ importlib = util.import_importlib('importlib') ...@@ -5,7 +5,6 @@ importlib = util.import_importlib('importlib')
machinery = util.import_importlib('importlib.machinery') machinery = util.import_importlib('importlib.machinery')
import os import os
import sys
from test import support as test_support from test import support as test_support
import unittest import unittest
......
import os import os
import sys
import json import json
import doctest import doctest
import unittest import unittest
......
...@@ -5,7 +5,6 @@ import errno ...@@ -5,7 +5,6 @@ import errno
import os import os
import select import select
import socket import socket
import sys
import time import time
import unittest import unittest
......
""" Test suite for the code in msilib """ """ Test suite for the code in msilib """
import unittest import unittest
import os
from test.support import import_module from test.support import import_module
msilib = import_module('msilib') msilib = import_module('msilib')
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
from test import support from test import support
from test.support import TESTFN from test.support import TESTFN
import unittest, io, codecs, sys, os import unittest, io, codecs, sys
import _multibytecodec import _multibytecodec
ALL_CJKENCODINGS = [ ALL_CJKENCODINGS = [
......
from test import support from test import support
import unittest import unittest
import sys
# Skip test if nis module does not exist. # Skip test if nis module does not exist.
nis = support.import_module('nis') nis = support.import_module('nis')
......
...@@ -3,7 +3,6 @@ import unittest ...@@ -3,7 +3,6 @@ import unittest
from http.client import HTTPException from http.client import HTTPException
import sys import sys
import os
from unicodedata import normalize, unidata_version from unicodedata import normalize, unidata_version
TESTDATAFILE = "NormalizationTest.txt" TESTDATAFILE = "NormalizationTest.txt"
......
import parser import parser
import unittest import unittest
import sys
import operator import operator
import struct import struct
from test import support from test import support
......
...@@ -2,7 +2,6 @@ import builtins ...@@ -2,7 +2,6 @@ import builtins
import os import os
import select import select
import socket import socket
import sys
import unittest import unittest
import errno import errno
from errno import EEXIST from errno import EEXIST
......
import itertools import itertools
import os import os
import posixpath import posixpath
import sys
import unittest import unittest
import warnings import warnings
from posixpath import realpath, abspath, dirname, basename from posixpath import realpath, abspath, dirname, basename
......
import io import io
import unittest import unittest
import sys
import xml.sax import xml.sax
from xml.sax.xmlreader import AttributesImpl from xml.sax.xmlreader import AttributesImpl
......
import unittest import unittest
import sys, os, io, subprocess import sys, io, subprocess
import quopri import quopri
......
from test import support from test import support
import random import random
import sys
import unittest import unittest
from functools import cmp_to_key from functools import cmp_to_key
......
...@@ -5,7 +5,6 @@ import time ...@@ -5,7 +5,6 @@ import time
import locale import locale
import re import re
import os import os
import sys
from test import support from test import support
from datetime import date as datetime_date from datetime import date as datetime_date
......
"""Tests for the md5sum script in the Tools directory.""" """Tests for the md5sum script in the Tools directory."""
import os import os
import sys
import unittest import unittest
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
......
"""Tests for the pdeps script in the Tools directory.""" """Tests for the pdeps script in the Tools directory."""
import os import os
import sys
import unittest import unittest
import tempfile import tempfile
from test import support from test import support
......
import os
import unittest import unittest
from test import support from test import support
......
import os
from test import support from test import support
# Skip this test if _tkinter does not exist. # Skip this test if _tkinter does not exist.
......
...@@ -352,7 +352,6 @@ Some size constraints (all fail.) ...@@ -352,7 +352,6 @@ Some size constraints (all fail.)
__test__ = {'doctests' : doctests} __test__ = {'doctests' : doctests}
def test_main(verbose=False): def test_main(verbose=False):
import sys
from test import support from test import support
from test import test_unpack_ex from test import test_unpack_ex
support.run_doctest(test_unpack_ex, verbose) support.run_doctest(test_unpack_ex, verbose)
......
...@@ -4,7 +4,6 @@ from test import support ...@@ -4,7 +4,6 @@ from test import support
import contextlib import contextlib
import socket import socket
import urllib.request import urllib.request
import sys
import os import os
import email.message import email.message
import time import time
......
...@@ -3,9 +3,7 @@ from weakref import proxy, ref, WeakSet ...@@ -3,9 +3,7 @@ from weakref import proxy, ref, WeakSet
import operator import operator
import copy import copy
import string import string
import os
from random import randrange, shuffle from random import randrange, shuffle
import sys
import warnings import warnings
import collections import collections
from collections import UserString as ustr from collections import UserString as ustr
......
# xml.etree test for cElementTree # xml.etree test for cElementTree
import sys, struct import struct
from test import support from test import support
from test.support import import_fresh_module from test.support import import_fresh_module
import types import types
......
import collections.abc import collections.abc
import errno import errno
import socket import socket
import sys
import unittest import unittest
from test import support from test import support
......
import contextlib import contextlib
import io import io
import os import os
import sys
import importlib.util import importlib.util
import posixpath import posixpath
import time import time
......
...@@ -7,7 +7,6 @@ Extensions also should live in packages following the same rule as above. ...@@ -7,7 +7,6 @@ Extensions also should live in packages following the same rule as above.
""" """
import os import os
import sys
import unittest import unittest
import importlib import importlib
import test.support import test.support
......
import sys
def is_instance(obj, klass): def is_instance(obj, klass):
"""Version of is_instance that doesn't access __class__""" """Version of is_instance that doesn't access __class__"""
return issubclass(type(obj), klass) return issubclass(type(obj), klass)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment