summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-02-27 04:03:00 +0000
committerZac Medico <zmedico@gentoo.org>2009-02-27 04:03:00 +0000
commit047b47f00df3e6f192bfd29c53ee2939440a0770 (patch)
tree14cf4179fe9621e4c70e32ef5297cc148463cbfd
parent353a4503129b8cdcb9c32b50424bfeb07dd11cd1 (diff)
downloadportage-047b47f00df3e6f192bfd29c53ee2939440a0770.tar.gz
portage-047b47f00df3e6f192bfd29c53ee2939440a0770.tar.bz2
portage-047b47f00df3e6f192bfd29c53ee2939440a0770.zip
Use os.fdopen() on file descriptors returned from mkstemp().
svn path=/main/trunk/; revision=12725
-rw-r--r--pym/portage/tests/sets/files/testConfigFileSet.py3
-rw-r--r--pym/portage/tests/sets/files/testStaticFileSet.py5
2 files changed, 4 insertions, 4 deletions
diff --git a/pym/portage/tests/sets/files/testConfigFileSet.py b/pym/portage/tests/sets/files/testConfigFileSet.py
index a7a9645cd..7ea17fd1b 100644
--- a/pym/portage/tests/sets/files/testConfigFileSet.py
+++ b/pym/portage/tests/sets/files/testConfigFileSet.py
@@ -13,8 +13,7 @@ class ConfigFileSetTestCase(TestCase):
def setUp(self):
fd, self.testfile = tempfile.mkstemp(suffix=".testdata", prefix=self.__class__.__name__, text=True)
- os.close(fd)
- f = open(self.testfile, 'w')
+ f = os.fdopen(fd, 'w')
for i in range(0, len(test_cps)):
atom = test_cps[i]
if i % 2 == 0:
diff --git a/pym/portage/tests/sets/files/testStaticFileSet.py b/pym/portage/tests/sets/files/testStaticFileSet.py
index 4c7a191b1..fff583da1 100644
--- a/pym/portage/tests/sets/files/testStaticFileSet.py
+++ b/pym/portage/tests/sets/files/testStaticFileSet.py
@@ -15,8 +15,9 @@ class StaticFileSetTestCase(TestCase):
def setUp(self):
fd, self.testfile = tempfile.mkstemp(suffix=".testdata", prefix=self.__class__.__name__, text=True)
- os.close(fd)
- open(self.testfile, 'w').write("\n".join(test_cps))
+ f = os.fdopen(fd, 'w')
+ f.write("\n".join(test_cps))
+ f.close()
def tearDown(self):
os.unlink(self.testfile)