diff options
Diffstat (limited to 'Lib/test/test_commands.py')
-rw-r--r-- | Lib/test/test_commands.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/Lib/test/test_commands.py b/Lib/test/test_commands.py index 27b6c3d56c..4e482d2fa3 100644 --- a/Lib/test/test_commands.py +++ b/Lib/test/test_commands.py @@ -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(): |