diff --git a/tests/__init__.py b/tests/__init__.py index e30200fa..c9d26b49 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -175,7 +175,7 @@ class QubesTestCase(unittest.TestCase): def __str__(self): return '{}/{}/{}'.format( - '.'.join(self.__class__.__module__.split('.')[2:]), + self.__class__.__module__, self.__class__.__name__, self._testMethodName) diff --git a/tests/extra.py b/tests/extra.py index 91efade8..c46a8a81 100644 --- a/tests/extra.py +++ b/tests/extra.py @@ -27,12 +27,12 @@ import qubes.tests import qubes.qubes -class ExtraTestMixin(qubes.tests.SystemTestsMixin): +class ExtraTestCase(qubes.tests.SystemTestsMixin, qubes.tests.QubesTestCase): template = None def setUp(self): - super(ExtraTestMixin, self).setUp() + super(ExtraTestCase, self).setUp() self.qc.unlock_db() def create_vms(self, names): @@ -74,13 +74,7 @@ class ExtraTestMixin(qubes.tests.SystemTestsMixin): def load_tests(loader, tests, pattern): for entry in pkg_resources.iter_entry_points('qubes.tests.extra'): for test_case in entry.load()(): - tests.addTests(loader.loadTestsFromTestCase( - type( - entry.name + '_' + test_case.__name__, - (test_case, ExtraTestMixin, qubes.tests.QubesTestCase), - {} - ) - )) + tests.addTests(loader.loadTestsFromTestCase(test_case)) try: qc = qubes.qubes.QubesVmCollection() @@ -100,8 +94,7 @@ def load_tests(loader, tests, pattern): type( '{}_{}_{}'.format( entry.name, test_case.__name__, template), - (test_case, ExtraTestMixin, - qubes.tests.QubesTestCase), + (test_case,), {'template': template} ) )) diff --git a/tests/run.py b/tests/run.py index dae4c0b7..78441eb3 100755 --- a/tests/run.py +++ b/tests/run.py @@ -314,7 +314,7 @@ def main(): for name in args.names: suite.addTests( [test for test in list_test_cases(alltests) - if (str(test)+'/').startswith(name.replace('.', '/')+'/')]) + if str(test).startswith(name)]) else: suite.addTests(loader.loadTestsFromName('qubes.tests'))