[asterisk-commits] gtjoseph: testsuite/asterisk/trunk r5894 - /asterisk/trunk/lib/python/asterisk/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Nov 4 18:21:45 CST 2014
Author: gtjoseph
Date: Tue Nov 4 18:21:40 2014
New Revision: 5894
URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=5894
Log:
testsute: Add 'add-relative-to-search-path' handler to TestModuleLoader
I've got some common code I want to share between a few tests so it's
in the test's parent directory. However, there doesn't seem to be a way
to add the parent directory to the search path without specifying an
absolute path. So, I added a helper to TestModuleLoader that will allow
you to add paths relative to the test directory.
Example:
test-modules:
add-test-to-search-path: 'True'
add-relative-to-search-path: ['..']
test-object:
config-section: object-config
typename: 'ManagerConfigTest.ManagerConfigTest'
This adds <test_path>/.. to the search path. I.E. The test's parent directory.
Tested-by: George Joseph
Review: https://reviewboard.asterisk.org/r/4134/
Modified:
asterisk/trunk/lib/python/asterisk/test_runner.py
Modified: asterisk/trunk/lib/python/asterisk/test_runner.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/lib/python/asterisk/test_runner.py?view=diff&rev=5894&r1=5893&r2=5894
==============================================================================
--- asterisk/trunk/lib/python/asterisk/test_runner.py (original)
+++ asterisk/trunk/lib/python/asterisk/test_runner.py Tue Nov 4 18:21:40 2014
@@ -268,6 +268,11 @@
TestModuleFinder.supported_paths.append(path)
sys.path.append(path)
+ if 'add-relative-to-search-path' in test_config['test-modules']:
+ for path in test_config['test-modules']['add-relative-to-search-path']:
+ TestModuleFinder.supported_paths.append(os.path.join(test_path, path))
+ sys.path.append(os.path.join(test_path, path))
+
def main(argv = None):
"""Main entry point for the test run
More information about the asterisk-commits
mailing list