Add controller configs attr back (#499)
To not break backward compatibility.
diff --git a/mobly/base_test.py b/mobly/base_test.py
index 5dc5e8f..03db500 100644
--- a/mobly/base_test.py
+++ b/mobly/base_test.py
@@ -66,6 +66,8 @@
name.
results: A records.TestResult object for aggregating test results from
the execution of tests.
+ controller_configs: dict, controller configs provided by the user via
+ test bed config.
current_test_name: [Deprecated, use `self.current_test_info.name`]
A string that's the name of the test method currently being
executed. If no test is executing, this should be None.
@@ -109,6 +111,7 @@
self._generated_test_table = collections.OrderedDict()
self._controller_manager = controller_manager.ControllerManager(
class_name=self.TAG, controller_configs=configs.controller_configs)
+ self.controller_configs = self._controller_manager.controller_configs
def __enter__(self):
return self
diff --git a/mobly/controller_manager.py b/mobly/controller_manager.py
index db23688..75370dd 100644
--- a/mobly/controller_manager.py
+++ b/mobly/controller_manager.py
@@ -53,6 +53,10 @@
This manages the life cycles and info retrieval of all controller objects
used in a test.
+
+ Attributes:
+ controller_configs: dict, controller configs provided by the user via
+ test bed config.
"""
def __init__(self, class_name, controller_configs):
@@ -61,7 +65,7 @@
) # controller_name: objects
self._controller_modules = {} # controller_name: module
self._class_name = class_name
- self._controller_configs = controller_configs
+ self.controller_configs = controller_configs
def register_controller(self, module, required=True, min_number=1):
"""Loads a controller module and returns its loaded devices.
@@ -100,7 +104,7 @@
'be registered again.' % module_ref_name)
# Create controller objects.
module_config_name = module.MOBLY_CONTROLLER_CONFIG_NAME
- if module_config_name not in self._controller_configs:
+ if module_config_name not in self.controller_configs:
if required:
raise signals.ControllerError(
'No corresponding config found for %s' %
@@ -112,7 +116,7 @@
try:
# Make a deep copy of the config to pass to the controller module,
# in case the controller module modifies the config internally.
- original_config = self._controller_configs[module_config_name]
+ original_config = self.controller_configs[module_config_name]
controller_config = copy.deepcopy(original_config)
objects = module.create(controller_config)
except: