From 047b47f00df3e6f192bfd29c53ee2939440a0770 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Fri, 27 Feb 2009 04:03:00 +0000 Subject: [PATCH] Use os.fdopen() on file descriptors returned from mkstemp(). svn path=/main/trunk/; revision=12725 --- pym/portage/tests/sets/files/testConfigFileSet.py | 3 +-- pym/portage/tests/sets/files/testStaticFileSet.py | 5 +++-- 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) -- 2.26.2