configurationengine/source/plugins/example/runtests.py
changeset 3 e7e0ae78773e
parent 0 2e8eeb919028
equal deleted inserted replaced
2:87cfa131b535 3:e7e0ae78773e
    12 # Contributors:
    12 # Contributors:
    13 #
    13 #
    14 # Description:
    14 # Description:
    15 #
    15 #
    16 
    16 
    17 import sys, os, re, unittest
    17 if __name__ == '__main__':
    18 
    18     import nose
    19 ROOT_PATH = os.path.abspath(os.path.dirname(__file__))
    19     nose.core.run(argv=['collector','--include=unittest', '--verbosity=3'])
    20 
       
    21 PLUGINS_ROOT = os.path.normpath(os.path.join(ROOT_PATH, '..'))
       
    22 assert os.path.split(PLUGINS_ROOT)[1] == 'plugins'
       
    23 if PLUGINS_ROOT not in sys.path: sys.path.append(PLUGINS_ROOT)
       
    24 import plugin_utils
       
    25 
       
    26 if __name__ == "__main__":
       
    27     # Collect a list of plug-in source paths and plug-in module names
       
    28     paths_and_modnames = plugin_utils.find_plugin_sources(ROOT_PATH)
       
    29     # Create a test suite from them
       
    30     suite = plugin_utils.collect_suite_from_source_list(paths_and_modnames)
       
    31     # Run the suite
       
    32     unittest.TextTestRunner(verbosity=2).run(suite)