diff -r 87cfa131b535 -r e7e0ae78773e configurationengine/source/scripts/tests/__init__.py --- a/configurationengine/source/scripts/tests/__init__.py Fri Mar 12 08:30:17 2010 +0200 +++ b/configurationengine/source/scripts/tests/__init__.py Tue Aug 10 14:29:28 2010 +0300 @@ -27,46 +27,16 @@ Set up everything so that running "python cone_tool.py" finds the ConE and plug-in modules. """ - sys.path.append(SOURCE_ROOT) - sys.path.append(os.path.join(SOURCE_ROOT, 'testautomation')) - - # Import the plugin_utils module from plugins/ - sys.path.append(PLUGIN_SOURCE_ROOT) - import plugin_utils - del sys.path[-1] + from testautomation import plugin_utils # Collect all needed plug-in source directories (all in 'common') plugin_sources = plugin_utils.find_plugin_sources(os.path.join(PLUGIN_SOURCE_ROOT, 'common')) plugin_source_paths = [path for path, _ in plugin_sources] - paths = [] - paths.append(SOURCE_ROOT) - paths.extend(plugin_source_paths) - os.environ['PYTHONPATH'] = os.environ.get('PYTHONPATH', '') + ';' + ';'.join(paths) - # Generate egg-info for the plug-ins if necessary - import build_egg_info + from testautomation import build_egg_info for path in plugin_source_paths: build_egg_info.generate_egg_info(path) _setup() -# Find all unittest_*.py files in this folder -import re -__all__ = filter(lambda name: re.match(r'^unittest_.*\.py$', name) != None, os.listdir(ROOT_PATH)) -# Strip .py endings -__all__ = map(lambda name: name[:-3], __all__) - -def collect_suite(): - suite = unittest.TestSuite() - for test_module in __all__: - # Load the test module dynamically and add it to the test suite - module = __import__(test_module) - suite.addTests(unittest.TestLoader().loadTestsFromModule(module)) - return suite - -def runtests(): - unittest.TextTestRunner(verbosity=2).run(collect_suite()) - -if __name__ == '__main__': - runtests()