From: Zac Medico Date: Fri, 27 Feb 2009 04:03:00 +0000 (-0000) Subject: Use os.fdopen() on file descriptors returned from mkstemp(). X-Git-Tag: v2.2_rc24~90 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=047b47f00df3e6f192bfd29c53ee2939440a0770;p=portage.git Use os.fdopen() on file descriptors returned from mkstemp(). svn path=/main/trunk/; revision=12725 --- 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)