diff options
author | Thomas Wouters <thomas@python.org> | 2003-03-25 18:50:19 (GMT) |
---|---|---|
committer | Thomas Wouters <thomas@python.org> | 2003-03-25 18:50:19 (GMT) |
commit | 590fe02ebdc2ec11347441ae31e71d2d6cd52ad3 (patch) | |
tree | 085b8783c18f50eb112d794d52b17c1cdcdf9612 /Lib | |
parent | 49754af873464babc9f2eb8359016e68e99577b6 (diff) | |
download | cpython-590fe02ebdc2ec11347441ae31e71d2d6cd52ad3.zip cpython-590fe02ebdc2ec11347441ae31e71d2d6cd52ad3.tar.gz cpython-590fe02ebdc2ec11347441ae31e71d2d6cd52ad3.tar.bz2 |
CommandTests.testgetoutput():
Make sure we aren't masking any errors raised in tempfile.mkdtemp() by
referencing the (then) unbound local 'dir'.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_commands.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/test/test_commands.py b/Lib/test/test_commands.py index ef87d79..0f7d15f 100644 --- a/Lib/test/test_commands.py +++ b/Lib/test/test_commands.py @@ -27,6 +27,7 @@ class CommandTests(unittest.TestCase): # we use mkdtemp in the next line to create an empty directory # under our exclusive control; from that, we can invent a pathname # that we _know_ won't exist. This is guaranteed to fail. + dir = None try: dir = tempfile.mkdtemp() name = os.path.join(dir, "foo") @@ -34,7 +35,8 @@ class CommandTests(unittest.TestCase): status, output = getstatusoutput('cat ' + name) self.assertNotEquals(status, 0) finally: - os.rmdir(dir) + if dir is not None: + os.rmdir(dir) def test_getstatus(self): # This pattern should match 'ls -ld /.' on any posix |