summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarius Mauch <genone@gentoo.org>2007-09-07 12:30:53 +0000
committerMarius Mauch <genone@gentoo.org>2007-09-07 12:30:53 +0000
commitdee01d0e9a0a02e8ed742cb055bfeb85b0a30030 (patch)
treec0fc562f32eeae0a3109ac3ed65c68fd95b5389b
parentad68fd1894e1905597ec7bc9f40f629b9b2f92a7 (diff)
downloadportage-dee01d0e9a0a02e8ed742cb055bfeb85b0a30030.tar.gz
portage-dee01d0e9a0a02e8ed742cb055bfeb85b0a30030.tar.bz2
portage-dee01d0e9a0a02e8ed742cb055bfeb85b0a30030.zip
Implement/fix testcases for some PackageSet subclasses
svn path=/main/trunk/; revision=7758
-rw-r--r--pym/portage/tests/sets/files/testConfigFileSet.py21
-rw-r--r--pym/portage/tests/sets/files/testStaticFileSet.py18
2 files changed, 25 insertions, 14 deletions
diff --git a/pym/portage/tests/sets/files/testConfigFileSet.py b/pym/portage/tests/sets/files/testConfigFileSet.py
index 633beb4bf..69acf3d10 100644
--- a/pym/portage/tests/sets/files/testConfigFileSet.py
+++ b/pym/portage/tests/sets/files/testConfigFileSet.py
@@ -3,17 +3,30 @@
# Distributed under the terms of the GNU General Public License v2
# $Id: testShell.py 7363 2007-07-22 23:21:14Z zmedico $
+import tempfile, os
+
from portage.tests import TestCase, test_cps
from portage.sets.files import ConfigFileSet
class ConfigFileSetTestCase(TestCase):
- """Simple Test Case for CommandOutputSet"""
+ """Simple Test Case for ConfigFileSet"""
def setUp(self):
- pass
+ fd, self.testfile = tempfile.mkstemp(suffix=".testdata", prefix=self.__class__.__name__, text=True)
+ for i in range(0, len(test_cps)):
+ atom = test_cps[i]
+ if i % 2 == 0:
+ os.write(fd, atom+" abc def"+"\n")
+ else:
+ os.write(fd, atom+"\n")
+ os.close(fd)
def tearDown(self):
+# os.unlink(self.testfile)
pass
- def testConfigFileSet(self):
- pass
+ def testConfigStaticFileSet(self):
+ s = ConfigFileSet('test', self.testfile)
+ s.load()
+ self.assertEqual(set(test_cps), s.getAtoms())
+
diff --git a/pym/portage/tests/sets/files/testStaticFileSet.py b/pym/portage/tests/sets/files/testStaticFileSet.py
index 92dd4dc19..8f0b5d050 100644
--- a/pym/portage/tests/sets/files/testStaticFileSet.py
+++ b/pym/portage/tests/sets/files/testStaticFileSet.py
@@ -3,28 +3,26 @@
# Distributed under the terms of the GNU General Public License v2
# $Id: testShell.py 7363 2007-07-22 23:21:14Z zmedico $
+import tempfile, os
+
from portage.tests import TestCase, test_cps
from portage.sets.files import StaticFileSet
from portage.env.loaders import TestTextLoader
from portage.env.config import ConfigLoaderKlass
class StaticFileSetTestCase(TestCase):
- """Simple Test Case for StaicFileSet"""
+ """Simple Test Case for StaticFileSet"""
def setUp(self):
- pass
+ fd, self.testfile = tempfile.mkstemp(suffix=".testdata", prefix=self.__class__.__name__, text=True)
+ os.write(fd, "\n".join(test_cps))
+ os.close(fd)
def tearDown(self):
- pass
+ os.unlink(self.testfile)
def testSampleStaticFileSet(self):
- d = {}
- for item in test_cps:
- d[item] = None
- loader = TestTextLoader(validator=None)
- loader.setData(d)
- data = ConfigLoaderKlass(loader)
- s = StaticFileSet('test', '/dev/null', data=data)
+ s = StaticFileSet('test', self.testfile)
s.load()
self.assertEqual(set(test_cps), s.getAtoms())