Add a bit of path mangling to allow deeper tests
authorAlec Warner <antarus@gentoo.org>
Thu, 11 Jan 2007 05:09:38 +0000 (05:09 -0000)
committerAlec Warner <antarus@gentoo.org>
Thu, 11 Jan 2007 05:09:38 +0000 (05:09 -0000)
svn path=/main/trunk/; revision=5537

tests/__init__.py
tests/portage_versions/__init__.py [new file with mode: 0644]
tests/portage_versions/test_vercmp.py [moved from tests/portage/test_vercmp.py with 100% similarity]

index 2808ed5a4927273a96b4cf73f6ecf91d012b5868..58ba3d41c84e82f01fda0fb2b8ee478045e98aee 100644 (file)
@@ -7,13 +7,13 @@ import os, unittest
 
 def main():
        
-       testDirs = ["portage", "portage_util"]
+       testDirs = ["portage", "portage_util", "test/foo"]
 
        suite = unittest.TestSuite()
 
        basedir = os.path.dirname(__file__)
        for mydir in testDirs:
-               suite.addTests(getTests(os.path.join(basedir, mydir)))
+               suite.addTests(getTests(os.path.join(basedir, mydir), basedir) )
 
        return unittest.TextTestRunner(verbosity=2).run(suite)
 
@@ -24,7 +24,7 @@ def my_import(name):
                mod = getattr(mod, comp)
        return mod
 
-def getTests( path ):
+def getTests( path, base_path ):
        """
 
        path is the path to a given subdir ( 'portage/' for example)
@@ -35,7 +35,8 @@ def getTests( path ):
        import os
        files = os.listdir( path )
        files = [ f[:-3] for f in files if f.startswith("test_") and f.endswith(".py") ]
-       parent_module = ".".join(("tests", os.path.basename(path)))
+       parent_path = path[len(base_path):]
+       parent_module = ".".join(("tests", parent_path))
        result = []
        for mymodule in files:
                try:
diff --git a/tests/portage_versions/__init__.py b/tests/portage_versions/__init__.py
new file mode 100644 (file)
index 0000000..e1c0ae5
--- /dev/null
@@ -0,0 +1,4 @@
+# tests/portage/__init__.py -- Portage Unit Test functionality
+# Copyright 2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: __init__.py 5522 2007-01-10 12:30:05Z antarus $