from portage.tests import TestCase
from portage.env.config import PackageKeywordsFile
+from tempfile import mkstemp
+import os
class PackageKeywordsFileTestCase(TestCase):
- fname = 'package.keywords'
cpv = 'sys-apps/portage'
keywords = ['~x86', 'amd64', '-mips']
self.NukeFile()
def BuildFile(self):
- f = open(self.fname, 'wb')
- f.write('%s %s\n' % (self.cpv, ' '.join(self.keywords)))
+ fd, self.fname = mkstemp()
+ f = os.fdopen(fd, 'w')
+ f.write("\n".join(self.atoms))
f.close()
def NukeFile(self):
from portage.env.config import PackageMaskFile
from portage.tests import TestCase
+from tempfile import mkstemp
class PackageMaskFileTestCase(TestCase):
self.NukeFile()
def BuildFile(self):
- from tempfile import mkstemp
fd, self.fname = mkstemp()
f = os.fdopen(fd, 'w')
f.write("\n".join(self.atoms))
# Distributed under the terms of the GNU General Public License v2
# $Id: test_PackageUseFile.py 6182 2007-03-06 07:35:22Z antarus $
+import os
from portage.tests import TestCase
from portage.env.config import PackageUseFile
+from tempfile import mkstemp
+
class PackageUseFileTestCase(TestCase):
- fname = 'package.use'
cpv = 'sys-apps/portage'
useflags = ['cdrom', 'far', 'boo', 'flag', 'blat']
self.NukeFile()
def BuildFile(self):
- f = open(self.fname, 'wb')
+ fd, self.fname = mkstemp()
+ f = os.fdopen(self.fname, 'wb')
f.write("%s %s" % (self.cpv, ' '.join(self.useflags)))
def NukeFile(self):