diff options
author | Alexandre Fayolle <alexandre.fayolle@logilab.fr> | 2009-09-10 12:59:50 +0200 |
---|---|---|
committer | Alexandre Fayolle <alexandre.fayolle@logilab.fr> | 2009-09-10 12:59:50 +0200 |
commit | 75fbb9acabf29424e256c4bb73da9646e0e30294 (patch) | |
tree | cf74d28ee63a8aeeddccd2f3f007e066307a023b | |
parent | 4c74a760e2722adea31df2da8cdcb88772d085b5 (diff) | |
download | logilab-common-75fbb9acabf29424e256c4bb73da9646e0e30294.tar.gz |
fixed usage of tempfile.mkstemp
-rw-r--r-- | test/unittest_testlib.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/test/unittest_testlib.py b/test/unittest_testlib.py index eacb5b8..1bf5123 100644 --- a/test/unittest_testlib.py +++ b/test/unittest_testlib.py @@ -641,12 +641,14 @@ class DecoratorTC(TestCase): @with_tempdir def createfile(list): - tempfile.mkstemp() - tempfile.mkstemp() + fd1, fn1 = tempfile.mkstemp() + fd2, fn2 = tempfile.mkstemp() dir = tempfile.mkdtemp() - tempfile.mkstemp(dir=dir) + fd3, fn3 = tempfile.mkstemp(dir=dir) tempfile.mkdtemp() list.append(True) + for fd in (fd1, fd2, fd3): + os.close(fd) self.assertFalse(witness) createfile(witness) @@ -672,11 +674,13 @@ class DecoratorTC(TestCase): @with_tempdir def createfile(): - tempfile.mkstemp() - tempfile.mkstemp() + fd1, fn1 = tempfile.mkstemp() + fd2, fn2 = tempfile.mkstemp() dir = tempfile.mkdtemp() - tempfile.mkstemp(dir=dir) + fd3, fn3 = tempfile.mkstemp(dir=dir) tempfile.mkdtemp() + for fd in (fd1, fd2, fd3): + os.close(fd) raise WitnessException() self.assertRaises(WitnessException, createfile) |