tests: fix and enable external tests loader

QubesOS/qubes-issues#1800
This commit is contained in:
Marek Marczykowski-Górecki 2016-04-20 02:26:16 +02:00
parent a1575b98d4
commit a707840596
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724
2 changed files with 11 additions and 4 deletions

View File

@ -971,6 +971,8 @@ def load_tests(loader, tests, pattern): # pylint: disable=unused-argument
'qubes.tests.int.tools.qubes_create',
'qubes.tests.int.tools.qvm_prefs',
'qubes.tests.int.tools.qvm_run',
# external modules
'qubes.tests.extra',
):
tests.addTests(loader.loadTestsFromName(modname))

View File

@ -32,6 +32,10 @@ class ExtraTestCase(qubes.tests.SystemTestsMixin, qubes.tests.QubesTestCase):
template = None
def setUp(self):
super(ExtraTestCase, self).setUp()
self.init_default_template(self.template)
def create_vms(self, names):
"""
Create AppVMs for the duration of the test. Will be automatically
@ -47,14 +51,15 @@ class ExtraTestCase(qubes.tests.SystemTestsMixin, qubes.tests.QubesTestCase):
for vmname in names:
vm = self.app.add_new_vm(qubes.vm.appvm.AppVM,
name=self.make_vm_name(vmname),
template=template)
vm.create_on_disk(verbose=False)
template=template,
label='red')
vm.create_on_disk()
self.save_and_reload_db()
# get objects after reload
vms = []
for vmname in names:
vms.append(self.app.domains[self.make_vm_name])
vms.append(self.app.domains[self.make_vm_name(vmname)])
return vms
def enable_network(self):
@ -66,7 +71,7 @@ class ExtraTestCase(qubes.tests.SystemTestsMixin, qubes.tests.QubesTestCase):
def load_tests(loader, tests, pattern):
for entry in pkg_resources.iter_entry_points('qubes.tests.extra'):
for test_case in entry():
for test_case in entry.load()():
tests.addTests(loader.loadTestsFromTestCase(test_case))
try: