aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlec Warner <antarus@gentoo.org>2007-03-07 06:38:05 +0000
committerAlec Warner <antarus@gentoo.org>2007-03-07 06:38:05 +0000
commit60cb59d71dd75b9ae476a9c6b6363ca1ff77375e (patch)
tree3f5ef21ec57865225acf6ab195bed661d7fc88aa /pym/portage/tests/env
parentTake marien's advice, turn Skips into Todos for clarity sake (diff)
downloadportage-60cb59d71dd75b9ae476a9c6b6363ca1ff77375e.tar.gz
portage-60cb59d71dd75b9ae476a9c6b6363ca1ff77375e.tar.bz2
portage-60cb59d71dd75b9ae476a9c6b6363ca1ff77375e.zip
Part of my attempt now involves cleaning up config; this means for me; removing the file-based stuff from it (config_path) and encapsulating that into classes. This is the first one, a simple PackageKeywords class that does file-based stuff, no recursion yet but soon. Trying to do TDD here as well,so tests first then code.
svn path=/main/trunk/; revision=6190
Diffstat (limited to 'pym/portage/tests/env')
-rw-r--r--pym/portage/tests/env/__init__.py5
-rw-r--r--pym/portage/tests/env/config/__init__.py5
-rw-r--r--pym/portage/tests/env/config/test_PackageKeywordsFile.py35
3 files changed, 45 insertions, 0 deletions
diff --git a/pym/portage/tests/env/__init__.py b/pym/portage/tests/env/__init__.py
new file mode 100644
index 000000000..50e38af99
--- /dev/null
+++ b/pym/portage/tests/env/__init__.py
@@ -0,0 +1,5 @@
+# tests/portage/env/__init__.py -- Portage Unit Test functionality
+# Copyright 2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
diff --git a/pym/portage/tests/env/config/__init__.py b/pym/portage/tests/env/config/__init__.py
new file mode 100644
index 000000000..7fc0d0e96
--- /dev/null
+++ b/pym/portage/tests/env/config/__init__.py
@@ -0,0 +1,5 @@
+# tests/portage/env/config/__init__.py -- Portage Unit Test functionality
+# Copyright 2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
diff --git a/pym/portage/tests/env/config/test_PackageKeywordsFile.py b/pym/portage/tests/env/config/test_PackageKeywordsFile.py
new file mode 100644
index 000000000..f39ef96d7
--- /dev/null
+++ b/pym/portage/tests/env/config/test_PackageKeywordsFile.py
@@ -0,0 +1,35 @@
+# test_PackageKeywordsFile.py -- Portage Unit Testing Functionality
+# Copyright 2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: test_PackageKeywordsFile.py 6182 2007-03-06 07:35:22Z antarus $
+
+from portage.tests import TestCase
+from portage.env.config import PackageKeywordsFile
+
+class PackageKeywordsFileTestCase(TestCase):
+
+ fname = 'package.keywords'
+ cpv = 'sys-apps/portage'
+ keywords = ['~x86', 'amd64', '-mips']
+
+ def testPackageKeywordsLoad(self):
+ """
+ A simple test to ensure the load works properly
+ """
+
+ self.BuildFile()
+ f = PackageKeywordsFile(self.fname)
+ f.load()
+ for cpv, keyword in f.iteritems():
+ self.assertEqual( cpv, self.cpv )
+ [k for k in keyword if self.assertTrue(k in self.keywords)]
+ self.NukeFile()
+
+ def BuildFile(self):
+ f = open(self.fname, 'wb')
+ f.write('%s %s\n' % (self.cpv, ' '.join(self.keywords)))
+ f.close()
+
+ def NukeFile(self):
+ import os
+ os.unlink(self.fname)