diff options
-rw-r--r-- | mobly/base_test.py | 2 | ||||
-rwxr-xr-x | tests/mobly/base_test_test.py | 15 |
2 files changed, 16 insertions, 1 deletions
diff --git a/mobly/base_test.py b/mobly/base_test.py index d6e9faa..97caece 100644 --- a/mobly/base_test.py +++ b/mobly/base_test.py @@ -905,7 +905,7 @@ class BaseTestClass: A list of strings, each is a test method name. """ test_names = [] - for name, _ in inspect.getmembers(self, callable): + for name, _ in inspect.getmembers(type(self), callable): if name.startswith('test_'): test_names.append(name) return test_names + list(self._generated_test_table.keys()) diff --git a/tests/mobly/base_test_test.py b/tests/mobly/base_test_test.py index e9a7e80..f8a9a87 100755 --- a/tests/mobly/base_test_test.py +++ b/tests/mobly/base_test_test.py @@ -274,6 +274,21 @@ class BaseTestTest(unittest.TestCase): mock_decorated.assert_called_once_with('test_decorated') mock_undecorated.assert_called_once_with('test_undecorated') + def test_get_existing_tests_do_not_call_properties(self): + + class MockBaseTest(base_test.BaseTestClass): + + def test_something(self): + pass + + @property + def not_a_test(self): + # This property should not be called during get_existing_tests() + never_call() + + bt_cls = MockBaseTest(self.mock_test_cls_configs) + bt_cls.run() + def test_missing_requested_test_func(self): class MockBaseTest(base_test.BaseTestClass): |