summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlexandre Fayolle <alexandre.fayolle@logilab.fr>2009-09-10 12:59:50 +0200
committerAlexandre Fayolle <alexandre.fayolle@logilab.fr>2009-09-10 12:59:50 +0200
commit75fbb9acabf29424e256c4bb73da9646e0e30294 (patch)
treecf74d28ee63a8aeeddccd2f3f007e066307a023b /test
parent4c74a760e2722adea31df2da8cdcb88772d085b5 (diff)
downloadlogilab-common-75fbb9acabf29424e256c4bb73da9646e0e30294.tar.gz
fixed usage of tempfile.mkstemp
Diffstat (limited to 'test')
-rw-r--r--test/unittest_testlib.py16
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)