Rewrite testing to use __test__ instead of hardcoded dirs
authorAlec Warner <antarus@gentoo.org>
Fri, 7 Sep 2007 09:40:39 +0000 (09:40 -0000)
committerAlec Warner <antarus@gentoo.org>
Fri, 7 Sep 2007 09:40:39 +0000 (09:40 -0000)
svn path=/main/trunk/; revision=7748

pym/portage/tests/__init__.py
pym/portage/tests/bin/__test__ [new file with mode: 0644]
pym/portage/tests/dep/__test__ [new file with mode: 0644]
pym/portage/tests/env/__test__ [new file with mode: 0644]
pym/portage/tests/env/config/__test__ [new file with mode: 0644]
pym/portage/tests/util/__test__ [new file with mode: 0644]
pym/portage/tests/versions/__test__ [new file with mode: 0644]
pym/portage/tests/xpak/__test__ [new file with mode: 0644]

index 2ade6d4022116285395e374708f248c0f5b48789..8380b6c31f167b56e26abb3d0a0f8d15f6ecbee3 100644 (file)
@@ -9,10 +9,21 @@ import time
 import unittest
 
 def main():
-       testDirs = ["bin", "dep", "ebuild",
-               "env/config", "util", "versions", "xpak", "sets/shell"]
+
+       TEST_FILE = '__test__'
        suite = unittest.TestSuite()
        basedir = os.path.dirname(__file__)
+       testDirs = []
+
+  # the os.walk help mentions relative paths as being quirky
+       # I was tired of adding dirs to the list, so now we add __test__
+       # to each dir we want tested.
+       for root, dirs, files in os.walk(os.getcwd()):
+               if ".svn" in dirs:
+                       dirs.remove('.svn')
+               if TEST_FILE in files:
+                       testDirs.append(root)
+
        for mydir in testDirs:
                suite.addTests(getTests(os.path.join(basedir, mydir), basedir) )
        return TextTestRunner(verbosity=2).run(suite)
diff --git a/pym/portage/tests/bin/__test__ b/pym/portage/tests/bin/__test__
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/pym/portage/tests/dep/__test__ b/pym/portage/tests/dep/__test__
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/pym/portage/tests/env/__test__ b/pym/portage/tests/env/__test__
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/pym/portage/tests/env/config/__test__ b/pym/portage/tests/env/config/__test__
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/pym/portage/tests/util/__test__ b/pym/portage/tests/util/__test__
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/pym/portage/tests/versions/__test__ b/pym/portage/tests/versions/__test__
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/pym/portage/tests/xpak/__test__ b/pym/portage/tests/xpak/__test__
new file mode 100644 (file)
index 0000000..e69de29