diff options
author | Alec Warner <antarus@gentoo.org> | 2007-01-11 05:09:38 +0000 |
---|---|---|
committer | Alec Warner <antarus@gentoo.org> | 2007-01-11 05:09:38 +0000 |
commit | 44a5c71bb162790b8a1a4e37a13cfc0574ac489b (patch) | |
tree | 414a816e953eb9ac0c9f35aaaf91ad704f96f4d0 /tests/__init__.py | |
parent | 204e04984f4f238e8991e025d50e95e69aed08f9 (diff) | |
download | portage-44a5c71bb162790b8a1a4e37a13cfc0574ac489b.tar.gz portage-44a5c71bb162790b8a1a4e37a13cfc0574ac489b.tar.bz2 portage-44a5c71bb162790b8a1a4e37a13cfc0574ac489b.zip |
Add a bit of path mangling to allow deeper tests
svn path=/main/trunk/; revision=5537
Diffstat (limited to 'tests/__init__.py')
-rw-r--r-- | tests/__init__.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/tests/__init__.py b/tests/__init__.py index 2808ed5a4..58ba3d41c 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -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: |