diff --git a/test/unit/tools/test_toolbox.py b/test/unit/tools/test_toolbox.py index 89f690a49eb..cf4c826b6cc 100644 --- a/test/unit/tools/test_toolbox.py +++ b/test/unit/tools/test_toolbox.py @@ -51,11 +51,9 @@ class BaseToolBoxTestCase(unittest.TestCase, UsesApp, UsesTools): @property def toolbox(self): - if self.__toolbox is None: - self.__toolbox = SimplifiedToolBox(self) - # wire app with this new toolbox - self.app.toolbox = self.__toolbox - return self.__toolbox + if self._toolbox is None: + self.app.toolbox = self._toolbox = SimplifiedToolBox(self) + return self._toolbox def setUp(self): self.reindexed = False @@ -67,7 +65,7 @@ class BaseToolBoxTestCase(unittest.TestCase, UsesApp, UsesTools): itp_config = os.path.join(self.test_directory, "integrated_tool_panel.xml") self.app.config.integrated_tool_panel_config = itp_config self.app.watchers = ConfigWatchers(self.app) - self.__toolbox = None + self._toolbox = None self.config_files = [] def _repo_install(self, changeset, config_filename=None): @@ -197,7 +195,7 @@ class ToolBoxTestCase(BaseToolBoxTestCase): macro_out.write(SIMPLE_MACRO.substitute(tool_version="3.0")) def check_tool_macro(): - tool = self.app.toolbox.get_tool("tool_with_macro") + tool = self.toolbox.get_tool("tool_with_macro") assert tool.version == "3.0" self._try_until_no_errors(check_tool_macro) @@ -216,7 +214,7 @@ class ToolBoxTestCase(BaseToolBoxTestCase): out.write('certainly not a valid tool') def check_tool_errors(): - tool = self.app.toolbox.get_tool("test_tool") + tool = self.toolbox.get_tool("test_tool") assert tool is not None assert tool.version == "1.0" assert tool.tool_errors == 'Current on-disk tool is not valid' @@ -227,7 +225,7 @@ class ToolBoxTestCase(BaseToolBoxTestCase): self._init_tool(filename="simple_tool.xml", version="2.0") def check_no_tool_errors(): - tool = self.app.toolbox.get_tool("test_tool") + tool = self.toolbox.get_tool("test_tool") assert tool is not None assert tool.version == "2.0" assert tool.tool_errors is None @@ -562,4 +560,4 @@ class SimplifiedToolBox(ToolBox): def reload_callback(test_case): test_case.app.tool_cache.cleanup() - test_case.__toolbox = test_case.app.toolbox = SimplifiedToolBox(test_case) + test_case._toolbox = test_case.app.toolbox = SimplifiedToolBox(test_case)