diff options
author | Wesley Wiedenmeier <wesley.wiedenmeier@gmail.com> | 2017-03-17 12:26:59 -0500 |
---|---|---|
committer | Scott Moser <smoser@brickies.net> | 2017-03-17 13:37:56 -0400 |
commit | 3ec116a1bb3646c2ff932bed24b4bf087b51cb8c (patch) | |
tree | 59a428b38e1406377465664655c2108b43c1e36a /tests | |
parent | d97ca2c89518e71ced86c057d8f853a457458cc9 (diff) | |
download | vyos-cloud-init-3ec116a1bb3646c2ff932bed24b4bf087b51cb8c.tar.gz vyos-cloud-init-3ec116a1bb3646c2ff932bed24b4bf087b51cb8c.zip |
Integration Testing: improve testcase subclassing
Use inspect.getmro(mod) rather than mod.__bases__ to test if a potential
testcase class inherits from CloudTestCase. This allows testcases to be
based on CloudTestCase indirectly, adding greater flexibility to the
structure of test classes.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/cloud_tests/testcases/__init__.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/cloud_tests/testcases/__init__.py b/tests/cloud_tests/testcases/__init__.py index 182c090a..a1d86d45 100644 --- a/tests/cloud_tests/testcases/__init__.py +++ b/tests/cloud_tests/testcases/__init__.py @@ -21,7 +21,7 @@ def discover_tests(test_name): raise ValueError('no test verifier found at: {}'.format(testmod_name)) return [mod for name, mod in inspect.getmembers(testmod) - if inspect.isclass(mod) and base_test in mod.__bases__ and + if inspect.isclass(mod) and base_test in inspect.getmro(mod) and getattr(mod, '__test__', True)] |