Signed-off-by: Katerina Koukiou <kkoukiou@xxxxxxxxxx> --- tests/libvirttest.py | 9 +++++---- tests/test_connect.py | 2 +- tests/test_domain.py | 5 +++-- tests/test_interface.py | 12 +++++++----- tests/test_network.py | 8 ++++---- tests/test_storage.py | 1 + 6 files changed, 21 insertions(+), 16 deletions(-) diff --git a/tests/libvirttest.py b/tests/libvirttest.py index 7a75ff3..776b12d 100644 --- a/tests/libvirttest.py +++ b/tests/libvirttest.py @@ -107,7 +107,6 @@ class BaseTestClass(): path = interface_obj.StorageVolCreateXML(xmldata.minimal_storage_vol_xml, 0) yield path - def get_test_domain(self): path = self.connect.ListDomains(0)[0] obj = self.bus.get_object('org.libvirt', path) @@ -196,7 +195,7 @@ class DomainEventStoppedDetailType(IntEnum): SHUTDOWN = 0 DESTROYED = 1 CRASHED = 2 - MIGRATED = 3 + MIGRATED = 3 SAVED = 4 FAILED = 5 FROM_SNAPSHOT = 6 @@ -205,9 +204,9 @@ class DomainEventStoppedDetailType(IntEnum): class DomainEventSuspendedDetailType(IntEnum): PAUSED = 0 - MIGRATED = 1 + MIGRATED = 1 IOERROR = 2 - WATCHDOG = 3 + WATCHDOG = 3 RESTORED = 4 FROM_SNAPSHOT = 5 API_ERROR = 6 @@ -240,10 +239,12 @@ class NetworkEvent(IntEnum): STARTED = 2 STOPPED = 3 + class NodeDeviceEvent(IntEnum): CREATED = 0 DELETED = 1 + class StoragePoolBuildFlags(IntEnum): NEW = 0 REPAIR = 1 diff --git a/tests/test_connect.py b/tests/test_connect.py index bb2d767..f481356 100755 --- a/tests/test_connect.py +++ b/tests/test_connect.py @@ -96,7 +96,7 @@ class TestConnect(libvirttest.BaseTestClass): def test_connect_interface_lookup_by_property(self, lookup_method_name, lookup_item, interface_create): """Parameterized test for all InterfaceLookupBy* API calls of Connect interface """ - original_path,_ = interface_create + original_path, _ = interface_create obj = self.bus.get_object('org.libvirt', original_path) prop = obj.Get('org.libvirt.Interface', lookup_item, dbus_interface=dbus.PROPERTIES_IFACE) path = getattr(self.connect, lookup_method_name)(prop) diff --git a/tests/test_domain.py b/tests/test_domain.py index b9a6d33..b5879b4 100755 --- a/tests/test_domain.py +++ b/tests/test_domain.py @@ -5,6 +5,7 @@ import libvirttest DBUS_EXCEPTION_MISSING_FUNCTION = 'this function is not supported by the connection driver' + class TestDomain(libvirttest.BaseTestClass): def test_api(self): obj, domain = self.get_test_domain() @@ -153,8 +154,8 @@ class TestDomain(libvirttest.BaseTestClass): def test_domain_vcpu_pin_info(self): obj, domain = self.get_test_domain() pinInfo_expected = [ - [ True, True, True, True, True, True, True, True ], - [ True, True, True, True, True, True, True, True ] + [True, True, True, True, True, True, True, True], + [True, True, True, True, True, True, True, True] ] pinInfo = domain.GetVcpuPinInfo(0) assert pinInfo == pinInfo_expected diff --git a/tests/test_interface.py b/tests/test_interface.py index 7fd9dbf..3f6b513 100755 --- a/tests/test_interface.py +++ b/tests/test_interface.py @@ -4,38 +4,40 @@ import dbus import libvirttest import pytest + @pytest.mark.usefixtures("interface_create") class TestInterface(libvirttest.BaseTestClass): """ Tests for methods and properties of the Interface interface """ def test_interface_undefine(self, interface_create): - _,interface_obj = interface_create + _, interface_obj = interface_create interface_obj.Destroy(0) interface_obj.Undefine() def test_interface_destroy(self, interface_create): - _,interface_obj = interface_create + _, interface_obj = interface_create interface_obj.Destroy(0) def test_interface_create(self, interface_create): - _,interface_obj = interface_create + _, interface_obj = interface_create interface_obj.Destroy(0) interface_obj.Create(0) def test_interface_get_xml_description(self, interface_create): - _,interface_obj = interface_create + _, interface_obj = interface_create assert isinstance(interface_obj.GetXMLDesc(0), dbus.String) def test_interface_properties_type(self, interface_create): """ Ensure correct return type for Interface properties """ - test_interface_path,_ = interface_create + test_interface_path, _ = interface_create obj = self.bus.get_object('org.libvirt', test_interface_path) props = obj.GetAll('org.libvirt.Interface', dbus_interface=dbus.PROPERTIES_IFACE) assert isinstance(props['Name'], dbus.String) assert isinstance(props['MAC'], dbus.String) assert isinstance(props['Active'], dbus.Boolean) + if __name__ == '__main__': libvirttest.run() diff --git a/tests/test_network.py b/tests/test_network.py index 11418cb..2e3a8f0 100755 --- a/tests/test_network.py +++ b/tests/test_network.py @@ -25,7 +25,7 @@ class TestNetwork(libvirttest.BaseTestClass): assert isinstance(props['UUID'], dbus.String) def test_network_autostart(self): - _,test_network = self.get_test_network() + _, test_network = self.get_test_network() interface_obj = dbus.Interface(test_network, 'org.libvirt.Network') autostart_expected = True interface_obj.Set('org.libvirt.Network', 'Autostart', autostart_expected, dbus_interface=dbus.PROPERTIES_IFACE) @@ -41,7 +41,7 @@ class TestNetwork(libvirttest.BaseTestClass): self.connect.connect_to_signal('NetworkEvent', domain_started) - _,test_network = self.get_test_network() + _, test_network = self.get_test_network() interface_obj = dbus.Interface(test_network, 'org.libvirt.Network') interface_obj.Destroy() interface_obj.Create() @@ -64,7 +64,7 @@ class TestNetwork(libvirttest.BaseTestClass): self.main_loop() def test_network_get_xml_description(self): - _,test_network = self.get_test_network() + _, test_network = self.get_test_network() interface_obj = dbus.Interface(test_network, 'org.libvirt.Network') assert isinstance(interface_obj.GetXMLDesc(0), dbus.String) @@ -77,7 +77,7 @@ class TestNetwork(libvirttest.BaseTestClass): self.connect.connect_to_signal('NetworkEvent', domain_undefined) - _,test_network = self.get_test_network() + _, test_network = self.get_test_network() interface_obj = dbus.Interface(test_network, 'org.libvirt.Network') interface_obj.Destroy() interface_obj.Undefine() diff --git a/tests/test_storage.py b/tests/test_storage.py index 63ecf91..631e107 100755 --- a/tests/test_storage.py +++ b/tests/test_storage.py @@ -4,6 +4,7 @@ import dbus import libvirttest import pytest + class TestStoragePool(libvirttest.BaseTestClass): def test_storage_pool_autostart(self): _, test_storage_pool = self.get_test_storage_pool() -- 2.17.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list