[svn-commits] mmichelson: branch mmichelson/bridge-tests r3310 - in /asterisk/team/mmichels...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Jul 11 14:40:21 CDT 2012


Author: mmichelson
Date: Wed Jul 11 14:40:17 2012
New Revision: 3310

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=3310
Log:
Change way by which search paths are added to a test.

Updated tests to use the new method as well.


Modified:
    asterisk/team/mmichelson/bridge-tests/lib/python/asterisk/TestRunner.py
    asterisk/team/mmichelson/bridge-tests/tests/cdr/cdr_fork_end_time/test-config.yaml
    asterisk/team/mmichelson/bridge-tests/tests/cdr/console_fork_after_busy_forward/test-config.yaml
    asterisk/team/mmichelson/bridge-tests/tests/cdr/console_fork_before_dial/test-config.yaml

Modified: asterisk/team/mmichelson/bridge-tests/lib/python/asterisk/TestRunner.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mmichelson/bridge-tests/lib/python/asterisk/TestRunner.py?view=diff&rev=3310&r1=3309&r2=3310
==============================================================================
--- asterisk/team/mmichelson/bridge-tests/lib/python/asterisk/TestRunner.py (original)
+++ asterisk/team/mmichelson/bridge-tests/lib/python/asterisk/TestRunner.py Wed Jul 11 14:40:17 2012
@@ -99,10 +99,6 @@
         # Not an error - just no optional modules specified
         return
 
-    # Assume that support for loading from the test path may be needed.
-    TestModuleFinder.supported_paths.append(test_path)
-    sys.path.append(test_path)
-
     for module_spec in test_config['test-modules']['modules']:
         # If there's a specific portion of the config for this module, use it
         if ('config-section' in module_spec
@@ -111,11 +107,6 @@
         else:
             module_config = test_config
 
-        if ('load-from-path' in module_spec):
-            TestModuleFinder.supported_paths.append(
-                module_spec['load-from-path'])
-            sys.path.append(module_spec['load-from-path'])
-
         module_type = load_and_parse_module(module_spec['typename'])
         # Modules take in two parameters: the module configuration object,
         # and the test object that they attach to
@@ -225,6 +216,28 @@
 
     return test_config
 
+def read_module_paths(test_config, test_path):
+    '''
+    Read additional paths required for loading modules for the test
+
+    Parameters:
+    test_config The test configuration object
+    '''
+
+    if not 'test-modules' in test_config:
+        # Don't log anything. The test will complain later when
+        # attempting to load modules
+        return
+
+    if ('add-test-to-search-path' in test_config['test-modules'] and
+            test_config['test-modules']['add-test-to-search-path']):
+        TestModuleFinder.supported_paths.append(test_path)
+        sys.path.append(test_path)
+
+    if 'add-to-search-path' in test_config['test-modules']:
+        for path in test_config['test-modules']['add-to-search-path']:
+            TestModuleFinder.supported_paths.append(path)
+            sys.path.append(path)
 
 def main(argv = None):
     ''' Main entry point for the test run
@@ -262,6 +275,8 @@
     if test_config is None:
         return 1
 
+    read_module_paths(test_config, test_directory)
+
     test_object = create_test_object(test_directory, test_config)
     if test_object is None:
         return 1

Modified: asterisk/team/mmichelson/bridge-tests/tests/cdr/cdr_fork_end_time/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mmichelson/bridge-tests/tests/cdr/cdr_fork_end_time/test-config.yaml?view=diff&rev=3310&r1=3309&r2=3310
==============================================================================
--- asterisk/team/mmichelson/bridge-tests/tests/cdr/cdr_fork_end_time/test-config.yaml (original)
+++ asterisk/team/mmichelson/bridge-tests/tests/cdr/cdr_fork_end_time/test-config.yaml Wed Jul 11 14:40:17 2012
@@ -10,12 +10,14 @@
          time of the second (<=1 second to accomodate potential timing differences).'
 
 test-modules:
+    add-to-search-path:
+        -
+            'tests/cdr'
     test-object:
         config-section: test-object-config
         typename: 'SimpleTestCase.SimpleTestCase'
     modules:
         -
-            load-from-path: 'tests/cdr'
             config-section: 'cdr-config'
             typename: 'ForkCdrModule.ForkCdrModuleEndTime'
 

Modified: asterisk/team/mmichelson/bridge-tests/tests/cdr/console_fork_after_busy_forward/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mmichelson/bridge-tests/tests/cdr/console_fork_after_busy_forward/test-config.yaml?view=diff&rev=3310&r1=3309&r2=3310
==============================================================================
--- asterisk/team/mmichelson/bridge-tests/tests/cdr/console_fork_after_busy_forward/test-config.yaml (original)
+++ asterisk/team/mmichelson/bridge-tests/tests/cdr/console_fork_after_busy_forward/test-config.yaml Wed Jul 11 14:40:17 2012
@@ -7,12 +7,14 @@
         expected behavior.'
 
 test-modules:
+    add-to-search-path:
+        -
+            'tests/cdr'
     test-object:
         config-section: test-object-config
         typename: 'SimpleTestCase.SimpleTestCase'
     modules:
         -
-            load-from-path: 'tests/cdr'
             config-section: 'cdr-config'
             typename: 'ForkCdrModule.ForkCdrModuleBasic'
 
@@ -57,4 +59,4 @@
         - asterisk : 'cdr_csv'
     tags:
         - CDR
-        - chan_local
+        - chan_local

Modified: asterisk/team/mmichelson/bridge-tests/tests/cdr/console_fork_before_dial/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mmichelson/bridge-tests/tests/cdr/console_fork_before_dial/test-config.yaml?view=diff&rev=3310&r1=3309&r2=3310
==============================================================================
--- asterisk/team/mmichelson/bridge-tests/tests/cdr/console_fork_before_dial/test-config.yaml (original)
+++ asterisk/team/mmichelson/bridge-tests/tests/cdr/console_fork_before_dial/test-config.yaml Wed Jul 11 14:40:17 2012
@@ -6,12 +6,14 @@
         answers and then immediately hangs up. CDRs are tested for expected behavior.'
 
 test-modules:
+    add-to-search-path:
+        -
+            'tests/cdr'
     test-object:
         config-section: test-object-config
         typename: 'SimpleTestCase.SimpleTestCase'
     modules:
         -
-            load-from-path: 'tests/cdr'
             config-section: 'cdr-config'
             typename: 'ForkCdrModule.ForkCdrModuleBasic'
 
@@ -60,4 +62,4 @@
     tags:
         - dial
         - CDR
-        - chan_local
+        - chan_local




More information about the svn-commits mailing list