summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pym/portage/tests/env/config/test_PackageKeywordsFile.py9
-rw-r--r--pym/portage/tests/env/config/test_PackageUseFile.py3
-rw-r--r--pym/portage/tests/env/config/test_PortageModulesFile.py31
3 files changed, 39 insertions, 4 deletions
diff --git a/pym/portage/tests/env/config/test_PackageKeywordsFile.py b/pym/portage/tests/env/config/test_PackageKeywordsFile.py
index 229d9dffe..fb053153b 100644
--- a/pym/portage/tests/env/config/test_PackageKeywordsFile.py
+++ b/pym/portage/tests/env/config/test_PackageKeywordsFile.py
@@ -10,7 +10,7 @@ import os
class PackageKeywordsFileTestCase(TestCase):
- cpv = 'sys-apps/portage'
+ cpv = ['sys-apps/portage']
keywords = ['~x86', 'amd64', '-mips']
def testPackageKeywordsFile(self):
@@ -22,16 +22,19 @@ class PackageKeywordsFileTestCase(TestCase):
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):
diff --git a/pym/portage/tests/env/config/test_PackageUseFile.py b/pym/portage/tests/env/config/test_PackageUseFile.py
index d20ab4572..93474b6f7 100644
--- a/pym/portage/tests/env/config/test_PackageUseFile.py
+++ b/pym/portage/tests/env/config/test_PackageUseFile.py
@@ -30,8 +30,9 @@ class PackageUseFileTestCase(TestCase):
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
diff --git a/pym/portage/tests/env/config/test_PortageModulesFile.py b/pym/portage/tests/env/config/test_PortageModulesFile.py
new file mode 100644
index 000000000..4d1b481e2
--- /dev/null
+++ b/pym/portage/tests/env/config/test_PortageModulesFile.py
@@ -0,0 +1,31 @@
+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)