mirror of
https://github.com/python/cpython.git
synced 2025-07-28 21:55:21 +00:00
Remove unused imports in test modules.
This commit is contained in:
parent
dc3694bee0
commit
a4f46e1292
74 changed files with 40 additions and 135 deletions
|
@ -12,8 +12,7 @@ warnings.filterwarnings('ignore', r".*commands.getstatus.. is deprecated",
|
|||
from test.test_support import run_unittest, reap_children, import_module
|
||||
|
||||
# Silence Py3k warning
|
||||
import_module('commands', deprecated=True)
|
||||
from commands import *
|
||||
commands = import_module('commands', deprecated=True)
|
||||
|
||||
# The module says:
|
||||
# "NB This only works (and is only relevant) for UNIX."
|
||||
|
@ -28,8 +27,8 @@ if os.name != 'posix':
|
|||
class CommandTests(unittest.TestCase):
|
||||
|
||||
def test_getoutput(self):
|
||||
self.assertEquals(getoutput('echo xyzzy'), 'xyzzy')
|
||||
self.assertEquals(getstatusoutput('echo xyzzy'), (0, 'xyzzy'))
|
||||
self.assertEquals(commands.getoutput('echo xyzzy'), 'xyzzy')
|
||||
self.assertEquals(commands.getstatusoutput('echo xyzzy'), (0, 'xyzzy'))
|
||||
|
||||
# we use mkdtemp in the next line to create an empty directory
|
||||
# under our exclusive control; from that, we can invent a pathname
|
||||
|
@ -39,7 +38,7 @@ class CommandTests(unittest.TestCase):
|
|||
dir = tempfile.mkdtemp()
|
||||
name = os.path.join(dir, "foo")
|
||||
|
||||
status, output = getstatusoutput('cat ' + name)
|
||||
status, output = commands.getstatusoutput('cat ' + name)
|
||||
self.assertNotEquals(status, 0)
|
||||
finally:
|
||||
if dir is not None:
|
||||
|
@ -60,7 +59,7 @@ class CommandTests(unittest.TestCase):
|
|||
/\. # and end with the name of the file.
|
||||
'''
|
||||
|
||||
self.assertTrue(re.match(pat, getstatus("/."), re.VERBOSE))
|
||||
self.assertTrue(re.match(pat, commands.getstatus("/."), re.VERBOSE))
|
||||
|
||||
|
||||
def test_main():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue