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)
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)
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:
--- /dev/null
+# 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 $