class PackageKeywordsFileTestCase(TestCase):
- cpv = 'sys-apps/portage'
+ cpv = ['sys-apps/portage']
keywords = ['~x86', 'amd64', '-mips']
def testPackageKeywordsFile(self):
try:
f = PackageKeywordsFile(self.fname)
f.load()
+ i = 0
for cpv, keyword in f.iteritems():
- self.assertEqual( cpv, self.cpv )
+ self.assertEqual( cpv, self.cpv[i] )
[k for k in keyword if self.assertTrue(k in self.keywords)]
+ i = i + 1
finally:
self.NukeFile()
def BuildFile(self):
fd, self.fname = mkstemp()
f = os.fdopen(fd, 'w')
- f.write("\n".join(self.atoms))
+ for c in self.cpv:
+ f.write("%s %s\n" % (c,' '.join(self.keywords)))
f.close()
def NukeFile(self):
def BuildFile(self):
fd, self.fname = mkstemp()
- f = os.fdopen(self.fname, 'wb')
+ f = os.fdopen(fd, 'wb')
f.write("%s %s" % (self.cpv, ' '.join(self.useflags)))
+ f.close()
def NukeFile(self):
import os
--- /dev/null
+import os
+
+from portage.tests import TestCase
+from portage.env.config import PortageModulesFile
+from tempfile import mkstemp
+
+class PortageModulesFileTestCase(TestCase):
+
+ keys = ['foo.bar','baz','bob','extra_key']
+ modules = ['spanky','zmedico','antarus','ricer']
+
+ def setUp(self):
+ for k,v in (self.keys, self.modules):
+ self.items[k] = v
+
+ def testPortageModulesFile(self):
+ self.BuildFile()
+ f = PortageModulesFile(self.fname)
+ for k in f.keys():
+ self.assertEqual( f[k], self.items[k] )
+ self.NukeFile()
+
+ def BuildFile(self):
+ fd,self.fname = mkstemp()
+ f = os.fdopen(self.fname, 'wb')
+ f.write('%s %s\n' % (self.cpv, ' '.join(self.keywords)))
+ f.close()
+
+ def NukeFile(self):
+ import os
+ os.unlink(self.fname)