tests: make PEP8 happier

This commit is contained in:
Frédéric Pierret (fepitre) 2019-11-17 01:54:22 +01:00
parent 3a6ed2d0cd
commit e092b40350
No known key found for this signature in database
GPG Key ID: 484010B5CDC576E2

View File

@ -32,6 +32,7 @@ import qubes.tests
import qubes.tests.init
import qubes.tests.storage_reflink
class TestApp(qubes.tests.TestEmitter):
pass
@ -314,6 +315,7 @@ class TC_30_VMCollection(qubes.tests.QubesTestCase):
self.vms.get_new_unused_qid()
# def test_200_get_vms_based_on(self):
# pass
@ -339,7 +341,8 @@ class TC_80_QubesInitialPools(qubes.tests.QubesTestCase):
def get_driver(self, fs_type, accessible):
qubes.tests.storage_reflink.mkdir_fs(self.test_dir, fs_type,
accessible=accessible, cleanup_via=self.addCleanup)
accessible=accessible,
cleanup_via=self.addCleanup)
self.app.load_initial_values()
varlibqubes = self.app.pools['varlibqubes']
@ -382,7 +385,7 @@ class TC_89_QubesEmpty(qubes.tests.QubesTestCase):
qubes.Qubes.create_empty_store('/tmp/qubestest.xml').close()
def test_100_property_migrate_default_fw_netvm(self):
xml_template = '''<?xml version="1.0" encoding="utf-8" ?>
xml_template = """<?xml version="1.0" encoding="utf-8" ?>
<qubes version="3.0">
<properties>
<property name="default_netvm">{default_netvm}</property>
@ -428,7 +431,7 @@ class TC_89_QubesEmpty(qubes.tests.QubesTestCase):
</domain>
</domains>
</qubes>
'''
"""
with self.subTest('default_setup'):
with open('/tmp/qubestest.xml', 'w') as xml_file:
xml_file.write(xml_template.format(
@ -438,7 +441,8 @@ class TC_89_QubesEmpty(qubes.tests.QubesTestCase):
self.assertEqual(
self.app.domains['sys-net'].netvm, None)
self.assertEqual(
self.app.domains['sys-firewall'].netvm, self.app.domains['sys-net'])
self.app.domains['sys-firewall'].netvm,
self.app.domains['sys-net'])
# property is no longer "default"
self.assertFalse(
self.app.domains['sys-firewall'].property_is_default('netvm'))
@ -525,7 +529,8 @@ class TC_90_Qubes(qubes.tests.QubesTestCase):
pass
def test_100_clockvm(self):
appvm = self.app.add_new_vm('AppVM', name='test-vm', template=self.template,
appvm = self.app.add_new_vm('AppVM', name='test-vm',
template=self.template,
label='red')
self.assertIsNone(self.app.clockvm)
self.assertNotIn('service.clocksync', appvm.features)
@ -539,7 +544,7 @@ class TC_90_Qubes(qubes.tests.QubesTestCase):
self.assertTrue(self.template.features['service.clocksync'])
def test_110_netvm_loop(self):
'''Netvm loop through default_netvm'''
"""Netvm loop through default_netvm"""
netvm = self.app.add_new_vm('AppVM', name='test-net',
template=self.template, label='red')
try:
@ -551,7 +556,7 @@ class TC_90_Qubes(qubes.tests.QubesTestCase):
del netvm
def test_111_netvm_loop(self):
'''Netvm loop through default_netvm'''
"""Netvm loop through default_netvm"""
netvm = self.app.add_new_vm('AppVM', name='test-net',
template=self.template, label='red')
try:
@ -566,6 +571,7 @@ class TC_90_Qubes(qubes.tests.QubesTestCase):
class MyTestHolder(qubes.tests.TestEmitter, qubes.PropertyHolder):
default_guivm = qubes.property('default_guivm',
default=(lambda self: 'dom0'))
holder = MyTestHolder(None)
guivm = self.app.add_new_vm('AppVM', name='sys-gui', guivm='dom0',
template=self.template, label='red')
@ -586,6 +592,7 @@ class TC_90_Qubes(qubes.tests.QubesTestCase):
class MyTestHolder(qubes.tests.TestEmitter, qubes.PropertyHolder):
guivm = qubes.property('guivm',
default=(lambda self: 'dom0'))
holder = MyTestHolder(None)
guivm = self.app.add_new_vm('AppVM', name='sys-gui', guivm='dom0',
template=self.template, label='red')
@ -611,7 +618,8 @@ class TC_90_Qubes(qubes.tests.QubesTestCase):
def test_201_remove_netvm(self):
netvm = self.app.add_new_vm('AppVM', name='test-netvm',
template=self.template, provides_network=True,
template=self.template,
provides_network=True,
label='red')
appvm = self.app.add_new_vm('AppVM', name='test-vm',
template=self.template,
@ -623,7 +631,8 @@ class TC_90_Qubes(qubes.tests.QubesTestCase):
def test_202_remove_default_netvm(self):
netvm = self.app.add_new_vm('AppVM', name='test-netvm',
template=self.template, provides_network=True,
template=self.template,
provides_network=True,
label='red')
netvm.netvm = None
self.app.default_netvm = netvm
@ -645,7 +654,8 @@ class TC_90_Qubes(qubes.tests.QubesTestCase):
template=self.template,
label='red')
appvm = self.app.add_new_vm('AppVM', name='test-appvm2',
template=self.template, default_dispvm=dispvm,
template=self.template,
default_dispvm=dispvm,
label='red')
with mock.patch.object(self.app, 'vmm'):
with self.assertRaises(qubes.exc.QubesVMInUseError):
@ -653,7 +663,8 @@ class TC_90_Qubes(qubes.tests.QubesTestCase):
def test_205_remove_appvm_dispvm(self):
appvm = self.app.add_new_vm('AppVM', name='test-appvm',
template=self.template, template_for_dispvms=True,
template=self.template,
template_for_dispvms=True,
label='red')
dispvm = self.app.add_new_vm('DispVM', name='test-dispvm',
template=appvm,