Skip to content

Commit

Permalink
tests: fix extra tests loader
Browse files Browse the repository at this point in the history
Fix load error reporting - make sure 'err' variable is transferred into
'runTest' function scope.
Then, relax test loading requirements - use 'resolve' instead of 'load',
to bypass dependencies check (defined in setup.py of the package). The
required dependencies should be handled by RPM already, and in some
cases may not match those in python package. An example is PDF
converter, where dependencies at python level are set for the actual
converter, which is irrelevant for running tests from dom0 (tests will
interact with PDF converter inside a VM).

(cherry picked from commit 1ebbfa8)
  • Loading branch information
marmarek committed Jun 24, 2020
1 parent 2c63631 commit f06ea6b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions qubes/tests/extra.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,11 @@ def load_tests(loader, tests, pattern):
if entry.name in exclude_list:
continue
try:
for test_case in entry.load()():
for test_case in entry.resolve()():
tests.addTests(loader.loadTestsFromNames([
'{}.{}'.format(test_case.__module__, test_case.__name__)]))
except Exception as err: # pylint: disable=broad-except
def runTest(self):
def runTest(self, err=err):
raise err
ExtraLoadFailure = type('ExtraLoadFailure',
(qubes.tests.QubesTestCase,),
Expand All @@ -229,13 +229,13 @@ def runTest(self):
if entry.name in exclude_list:
continue
try:
for test_case in entry.load()():
for test_case in entry.resolve()():
tests.addTests(loader.loadTestsFromNames(
qubes.tests.create_testcases_for_templates(
test_case.__name__, test_case,
module=sys.modules[test_case.__module__])))
except Exception as err: # pylint: disable=broad-except
def runTest(self):
def runTest(self, err=err):
raise err
ExtraForTemplateLoadFailure = type('ExtraForTemplateLoadFailure',
(qubes.tests.QubesTestCase,),
Expand Down

0 comments on commit f06ea6b

Please sign in to comment.