tests: fix loading tests for templates

Fix #209
This commit is contained in:
Marek Marczykowski-Górecki 2018-07-15 21:57:34 +02:00
parent 39a9e4e422
commit f8d17012c3
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724
5 changed files with 11 additions and 7 deletions

View File

@ -207,10 +207,10 @@ def load_tests(loader, tests, pattern):
'qubes.tests.extra.for_template'):
try:
for test_case in entry.load()():
test.addTests(loader.loadTestsFromNames(
tests.addTests(loader.loadTestsFromNames(
qubes.tests.create_testcases_for_templates(
test_case.__name__, test_case,
globals=sys.modules[test_case.__module__].__dict__)))
module=sys.modules[test_case.__module__])))
except Exception as err: # pylint: disable=broad-except
def runTest(self):
raise err

View File

@ -654,5 +654,5 @@ def load_tests(loader, tests, pattern):
tests.addTests(loader.loadTestsFromNames(
qubes.tests.create_testcases_for_templates('TC_10_BackupVM',
TC_10_BackupVMMixin, qubes.tests.SystemTestCase,
globals=globals())))
module=sys.modules[__name__])))
return tests

View File

@ -35,6 +35,8 @@ import collections
import pkg_resources
import shutil
import sys
import qubes
import qubes.firewall
import qubes.tests
@ -796,11 +798,11 @@ def load_tests(loader, tests, pattern):
tests.addTests(loader.loadTestsFromNames(
qubes.tests.create_testcases_for_templates('TC_05_StandaloneVM',
TC_05_StandaloneVMMixin, qubes.tests.SystemTestCase,
globals=globals())))
module=sys.modules[__name__])))
tests.addTests(loader.loadTestsFromNames(
qubes.tests.create_testcases_for_templates('TC_06_AppVM',
TC_06_AppVMMixin, qubes.tests.SystemTestCase,
globals=globals())))
module=sys.modules[__name__])))
return tests

View File

@ -28,6 +28,8 @@ from distutils import spawn
import asyncio
import sys
import qubes.tests
class TC_04_DispVM(qubes.tests.SystemTestCase):
@ -285,5 +287,5 @@ def load_tests(loader, tests, pattern):
tests.addTests(loader.loadTestsFromNames(
qubes.tests.create_testcases_for_templates('TC_20_DispVM',
TC_20_DispVMMixin, qubes.tests.SystemTestCase,
globals=globals())))
module=sys.modules[__name__])))
return tests

View File

@ -1330,6 +1330,6 @@ def load_tests(loader, tests, pattern):
module=sys.modules[__name__])))
tests.addTests(loader.loadTestsFromNames(
qubes.tests.create_testcases_for_templates('VmUpdates',
VmUpdates, qubes.tests.SystemTestCase,
VmUpdatesMixin, qubes.tests.SystemTestCase,
module=sys.modules[__name__])))
return tests