aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafael G. Martins <rafael@rafaelmartins.eng.br>2010-05-29 01:29:00 -0300
committerRafael G. Martins <rafael@rafaelmartins.eng.br>2010-05-29 01:29:00 -0300
commit33216aa5c15b65a4ad714e0361acd2a6a10ed27c (patch)
tree904a0880331274ab5b334db29970a964d7a7910a /tests/test_description_tree.py
parentadded more files to the example tree used by the tests (diff)
downloadg-octave-33216aa5c15b65a4ad714e0361acd2a6a10ed27c.tar.gz
g-octave-33216aa5c15b65a4ad714e0361acd2a6a10ed27c.tar.bz2
g-octave-33216aa5c15b65a4ad714e0361acd2a6a10ed27c.zip
fixed tests to the module g_octave.description_tree. tests are now using the example tree, distributed with
g-octave
Diffstat (limited to 'tests/test_description_tree.py')
-rw-r--r--tests/test_description_tree.py55
1 files changed, 27 insertions, 28 deletions
diff --git a/tests/test_description_tree.py b/tests/test_description_tree.py
index a8f0d50..7e9f527 100644
--- a/tests/test_description_tree.py
+++ b/tests/test_description_tree.py
@@ -21,32 +21,18 @@ from g_octave import description, description_tree
class TestDescriptionTree(unittest.TestCase):
- _packages = [
- ('main', 'pkg1', '1.0'),
- ('main', 'pkg2', '0.1'),
- ('main', 'pkg2', '0.2'),
- ('extra', 'pkg1', '1.1'),
- ('language', 'lang', '0.1'),
- ]
-
def setUp(self):
- self._tree_dir = utils.create_description_tree(self._packages)
- self._tree = description_tree.DescriptionTree(self._tree_dir)
-
- def test_temptree(self):
- for cat, pkg, ver in self._packages:
- temp_file = os.path.join(
- self._tree_dir,
- cat, pkg+'-'+ver,
- 'DESCRIPTION'
- )
- self.assertTrue(os.path.exists(temp_file))
+ conf, self._config_file, self._tempdir = utils.create_env()
+ self._tree = description_tree.DescriptionTree(conf = conf)
def test_package_versions(self):
versions = {
- 'pkg1': ['1.0', '1.1'],
- 'pkg2': ['0.1', '0.2'],
- 'lang': ['0.1'],
+ 'main1': ['0.0.1'],
+ 'main2': ['0.0.1', '0.0.2'],
+ 'extra1': ['0.0.1'],
+ 'extra2': ['0.0.1', '0.0.2'],
+ 'language1': ['0.0.1'],
+ 'language2': ['0.0.1', '0.0.2'],
}
for pkg in versions:
ver = self._tree.package_versions(pkg)
@@ -56,9 +42,12 @@ class TestDescriptionTree(unittest.TestCase):
def test_latest_version(self):
versions = {
- 'pkg1': '1.1',
- 'pkg2': '0.2',
- 'lang': '0.1',
+ 'main1': '0.0.1',
+ 'main2': '0.0.2',
+ 'extra1': '0.0.1',
+ 'extra2': '0.0.2',
+ 'language1': '0.0.1',
+ 'language2': '0.0.2',
}
for pkg in versions:
self.assertEqual(
@@ -87,7 +76,18 @@ class TestDescriptionTree(unittest.TestCase):
self.assertEqual(self._tree.version_compare(ver), latest)
def test_description_files(self):
- for cat, pkg, ver in self._packages:
+ packages = [
+ ('main', 'main1', '0.0.1'),
+ ('main', 'main2', '0.0.1'),
+ ('main', 'main2', '0.0.2'),
+ ('extra', 'extra1', '0.0.1'),
+ ('extra', 'extra2', '0.0.1'),
+ ('extra', 'extra2', '0.0.2'),
+ ('language', 'language1', '0.0.1'),
+ ('language', 'language2', '0.0.1'),
+ ('language', 'language2', '0.0.2'),
+ ]
+ for cat, pkg, ver in packages:
self.assertTrue(
isinstance(
self._tree[pkg+'-'+ver],
@@ -97,12 +97,11 @@ class TestDescriptionTree(unittest.TestCase):
def tearDown(self):
# removing the temp tree
- shutil.rmtree(self._tree_dir)
+ utils.clean_env(self._config_file, self._tempdir)
def suite():
suite = unittest.TestSuite()
- suite.addTest(TestDescriptionTree('test_temptree'))
suite.addTest(TestDescriptionTree('test_package_versions'))
suite.addTest(TestDescriptionTree('test_latest_version'))
suite.addTest(TestDescriptionTree('test_version_compare'))