From 6643af97254db89f9321084a9431575421eeb214 Mon Sep 17 00:00:00 2001 From: raoyitao Date: Mon, 17 May 2021 11:43:56 +0800 Subject: [PATCH] Fix: ProcessRunnerTest raises in interactive mode during reloading * ``ProcessRunnerTest`` and other tests based on it (such as ``GTest``) cannot work well with interactive reloading of plan because there is an exception message printed on console. Actually that is not a real error because Testplan can only reload Multitest instance but all ``ProcessRunnerTest`` uses a binary to execute tests, so if need to reload them just replace the binary. --- testplan/runnable/interactive/reloader.py | 6 ++---- tests/unit/testplan/testing/test_filtering.py | 1 - 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/testplan/runnable/interactive/reloader.py b/testplan/runnable/interactive/reloader.py index c329c438d..173f269b8 100644 --- a/testplan/runnable/interactive/reloader.py +++ b/testplan/runnable/interactive/reloader.py @@ -10,9 +10,9 @@ from imp import reload from testplan.common.utils import path as path_utils -from testplan.testing.multitest import suite from testplan.common.utils import logger from testplan.common.utils import strings +from testplan.testing.multitest import suite, MultiTest class ModuleReloader(logger.Loggable): @@ -196,13 +196,11 @@ def _suites_by_class(self, tests): functools.partial(collections.defaultdict, list) ) for test in tests: - try: + if isinstance(test, MultiTest): for suite in test.cfg.suites: suite_dict[suite.__module__][ suite.__class__.__name__ ].append(suite) - except AttributeError: - self.logger.exception("Test %r has no suites", test) return suite_dict def _reload_modified_modules(self, modified_modules, suite_instances): diff --git a/tests/unit/testplan/testing/test_filtering.py b/tests/unit/testplan/testing/test_filtering.py index c78f5b430..3f38958fe 100644 --- a/tests/unit/testplan/testing/test_filtering.py +++ b/tests/unit/testplan/testing/test_filtering.py @@ -1,7 +1,6 @@ import pytest from testplan.testing.multitest import MultiTest, testsuite, testcase -from testplan.testing.multitest import parametrization from testplan.testing import filtering