Notice: the grml team is migrating from Mercurial to Git.
Please visit git.grml.org instead!
| author | Michael Gebetsroither <michael.geb@gmx.at> |
| Mon Mar 24 15:39:50 2008 +0100 (8 months ago) | |
| changeset 179 | 1945b9335188 |
| manifest | 1945b9335188 |
| parent 178 | 1a2336bee53a |
| child 180 | 3f56617d709e |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000+++ b/tests/reposearch.py Mon Mar 24 15:39:50 2008 +0100@@ -0,0 +1,1 @@+../reposearch\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000+++ b/tests/reposearch_tests.py Mon Mar 24 15:39:50 2008 +0100@@ -0,0 +1,44 @@+'''Unittest for reposearch'''++import sys+import os+import os.path as op++import reposearch as rs+import unittest++class Base(unittest.TestCase):+ dir = "reposearch_data"+ def inner(self, f):+ old = op.abspath(os.curdir)+ os.chdir(self.dir)+ try:+ tmp = f()+ finally:+ os.chdir(old)+ return tmp++class Git(Base):+ def testFlatOuter(self):+ should = ['reposearch_data/git/a', 'reposearch_data/git/b']+ curr = list(rs.walkrepos_flat(+ op.join(self.dir, 'git'), rs.repo_types['git']))+ self.assertEqual(should, curr)+ def testFlatInner(self):+ should = ['git/a', 'git/b']+ curr = self.inner(lambda: list(rs.walkrepos_flat('git', rs.repo_types['git'])))+ self.assertEqual(should, curr)++ def testRecOuter(self):+ should = ['reposearch_data/git/a', 'reposearch_data/git/b',+ 'reposearch_data/git/dir/a', 'reposearch_data/git/dir/b']+ curr = list(rs.walkrepos(+ op.join(self.dir, 'git'), rs.repo_types['git']))+ self.assertEqual(should, curr)+ def testRecInner(self):+ should = ['git/a', 'git/b', 'git/dir/a', 'git/dir/b']+ curr = self.inner(lambda: list(rs.walkrepos('git', rs.repo_types['git'])))+ self.assertEqual(should, curr)++if __name__ == "__main__":+ unittest.main()