[dbus PATCH v2 04/17] tests: rename test_* functions which are not tests

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



pytest collects functions starting with test prefix
to run them as tests by default.

Rename functions that are not supposed to be run as tests,
to avoid unexpected failures.

Note: this commit also renames domain function to follow
the naming convention for same purpose functions.

Signed-off-by: Katerina Koukiou <kkoukiou@xxxxxxxxxx>
---
 tests/libvirttest.py  |  6 +++---
 tests/test_connect.py |  6 +++---
 tests/test_domain.py  | 20 ++++++++++----------
 tests/test_network.py | 14 +++++++-------
 tests/test_storage.py | 22 +++++++++++-----------
 5 files changed, 34 insertions(+), 34 deletions(-)

diff --git a/tests/libvirttest.py b/tests/libvirttest.py
index 3cd02ef..23a597f 100644
--- a/tests/libvirttest.py
+++ b/tests/libvirttest.py
@@ -70,12 +70,12 @@ class BaseTestClass():
         if self.timeout:
             raise TimeoutError()
 
-    def domain(self):
+    def get_test_domain(self):
         path = self.connect.ListDomains(0)[0]
         obj = self.bus.get_object('org.libvirt', path)
         return obj, dbus.Interface(obj, 'org.libvirt.Domain')
 
-    def test_network(self):
+    def get_test_network(self):
         """Fetch information for the test network from test driver
 
         Returns:
@@ -87,7 +87,7 @@ class BaseTestClass():
         obj = self.bus.get_object('org.libvirt', path)
         return path, obj
 
-    def test_storage_pool(self):
+    def get_test_storage_pool(self):
         """Fetch information for the test storage pool from test driver
 
         Returns:
diff --git a/tests/test_connect.py b/tests/test_connect.py
index 01b6bd1..ec3f551 100755
--- a/tests/test_connect.py
+++ b/tests/test_connect.py
@@ -46,7 +46,7 @@ class TestConnect(libvirttest.BaseTestClass):
         """Parameterized test for all DomainLookupBy* API calls of Connect interface
         """
         original_path = self.connect.ListDomains(0)[0]
-        obj, _ = self.domain()
+        obj, _ = self.get_test_domain()
         props = obj.GetAll('org.libvirt.Domain', dbus_interface=dbus.PROPERTIES_IFACE)
         path = getattr(self.connect, lookup_method_name)(props[lookup_item])
         assert original_path == path
@@ -150,7 +150,7 @@ class TestConnect(libvirttest.BaseTestClass):
     def test_connect_network_lookup_by_property(self, lookup_method_name, lookup_item):
         """Parameterized test for all NetworkLookupBy* API calls of Connect interface
         """
-        original_path, obj = self.test_network()
+        original_path, obj = self.get_test_network()
         prop = obj.Get('org.libvirt.Network', lookup_item, dbus_interface=dbus.PROPERTIES_IFACE)
         path = getattr(self.connect, lookup_method_name)(prop)
         assert original_path == path
@@ -206,7 +206,7 @@ class TestConnect(libvirttest.BaseTestClass):
                                                      lookup_item):
         """Parameterized test for all StoragePoolLookupBy* API calls of Connect interface
         """
-        original_path, obj = self.test_storage_pool()
+        original_path, obj = self.get_test_storage_pool()
         prop = obj.Get('org.libvirt.StoragePool', 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 dbb1e3d..b9a6d33 100755
--- a/tests/test_domain.py
+++ b/tests/test_domain.py
@@ -7,7 +7,7 @@ DBUS_EXCEPTION_MISSING_FUNCTION = 'this function is not supported by the connect
 
 class TestDomain(libvirttest.BaseTestClass):
     def test_api(self):
-        obj, domain = self.domain()
+        obj, domain = self.get_test_domain()
 
         props = obj.GetAll('org.libvirt.Domain', dbus_interface=dbus.PROPERTIES_IFACE)
         assert isinstance(props['Active'], dbus.Boolean)
@@ -39,7 +39,7 @@ class TestDomain(libvirttest.BaseTestClass):
         domain.Undefine(0)
 
     def test_domain_autostart(self):
-        _, domain = self.domain()
+        _, domain = self.get_test_domain()
         autostart_expected = True
         domain.Set('org.libvirt.Domain', 'Autostart', autostart_expected, dbus_interface=dbus.PROPERTIES_IFACE)
         autostart_current = domain.Get('org.libvirt.Domain', 'Autostart', dbus_interface=dbus.PROPERTIES_IFACE)
@@ -55,7 +55,7 @@ class TestDomain(libvirttest.BaseTestClass):
 
         self.connect.connect_to_signal('DomainEvent', domain_stopped)
 
-        obj, domain = self.domain()
+        obj, domain = self.get_test_domain()
         domain.ManagedSave(0)
         assert domain.HasManagedSaveImage(0) == dbus.Boolean(True)
         state, _ = domain.GetState(0)
@@ -67,7 +67,7 @@ class TestDomain(libvirttest.BaseTestClass):
 
     def test_domain_metadata(self):
         metadata_description = 0
-        obj, domain = self.domain()
+        obj, domain = self.get_test_domain()
         description_expected = "This is the Test domain"
         domain.SetMetadata(metadata_description,
                            description_expected, "", "", 0)
@@ -83,7 +83,7 @@ class TestDomain(libvirttest.BaseTestClass):
 
         self.connect.connect_to_signal('DomainEvent', domain_resumed)
 
-        obj, domain = self.domain()
+        obj, domain = self.get_test_domain()
         domain.Suspend()
         domain.Resume()
 
@@ -102,7 +102,7 @@ class TestDomain(libvirttest.BaseTestClass):
 
         self.connect.connect_to_signal('DomainEvent', domain_stopped)
 
-        obj, domain = self.domain()
+        obj, domain = self.get_test_domain()
         domain.Shutdown(0)
 
         state, _ = domain.GetState(0)
@@ -120,7 +120,7 @@ class TestDomain(libvirttest.BaseTestClass):
 
         self.connect.connect_to_signal('DomainEvent', domain_suspended)
 
-        obj, domain = self.domain()
+        obj, domain = self.get_test_domain()
         domain.Suspend()
 
         state, _ = domain.GetState(0)
@@ -138,20 +138,20 @@ class TestDomain(libvirttest.BaseTestClass):
 
         self.connect.connect_to_signal('DomainEvent', domain_undefined)
 
-        _, domain = self.domain()
+        _, domain = self.get_test_domain()
         domain.Shutdown(0)
         domain.Undefine(0)
 
         self.main_loop()
 
     def test_domain_vcpus(self):
-        obj, domain = self.domain()
+        obj, domain = self.get_test_domain()
         vcpus_expected = 2
         domain.SetVcpus(vcpus_expected, 0)
         assert domain.GetVcpus(0) == dbus.Int32(vcpus_expected)
 
     def test_domain_vcpu_pin_info(self):
-        obj, domain = self.domain()
+        obj, domain = self.get_test_domain()
         pinInfo_expected = [
                 [ True, True, True, True, True, True, True, True ],
                 [ True, True, True, True, True, True, True, True ]
diff --git a/tests/test_network.py b/tests/test_network.py
index 1a71536..11418cb 100755
--- a/tests/test_network.py
+++ b/tests/test_network.py
@@ -16,7 +16,7 @@ class TestNetwork(libvirttest.BaseTestClass):
     def test_network_properties_type(self):
         """ Ensure correct return type for Network properties
         """
-        _, obj = self.test_network()
+        _, obj = self.get_test_network()
         props = obj.GetAll('org.libvirt.Network', dbus_interface=dbus.PROPERTIES_IFACE)
         assert isinstance(props['Active'], dbus.Boolean)
         assert isinstance(props['Autostart'], dbus.Boolean)
@@ -25,7 +25,7 @@ class TestNetwork(libvirttest.BaseTestClass):
         assert isinstance(props['UUID'], dbus.String)
 
     def test_network_autostart(self):
-        _,test_network = self.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.test_network()
+        _,test_network = self.get_test_network()
         interface_obj = dbus.Interface(test_network, 'org.libvirt.Network')
         interface_obj.Destroy()
         interface_obj.Create()
@@ -57,14 +57,14 @@ class TestNetwork(libvirttest.BaseTestClass):
 
         self.connect.connect_to_signal('NetworkEvent', network_stopped)
 
-        _, test_network = self.test_network()
+        _, test_network = self.get_test_network()
         interface_obj = dbus.Interface(test_network, 'org.libvirt.Network')
         interface_obj.Destroy()
 
         self.main_loop()
 
     def test_network_get_xml_description(self):
-        _,test_network = self.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.test_network()
+        _,test_network = self.get_test_network()
         interface_obj = dbus.Interface(test_network, 'org.libvirt.Network')
         interface_obj.Destroy()
         interface_obj.Undefine()
@@ -88,7 +88,7 @@ class TestNetwork(libvirttest.BaseTestClass):
         ('4', '4', 0, ip_dhcp_host_xml, 0),  # add-first, ip-dhcp-host
     ])
     def test_network_update(self, command, section, parentIndex, xml_str, flags):
-        _, test_network = self.test_network()
+        _, test_network = self.get_test_network()
         interface_obj = dbus.Interface(test_network, 'org.libvirt.Network')
         interface_obj.Update(command, section, parentIndex, xml_str, flags)
         updated_netxml = interface_obj.GetXMLDesc(0)
diff --git a/tests/test_storage.py b/tests/test_storage.py
index 79e0c16..10bcea3 100755
--- a/tests/test_storage.py
+++ b/tests/test_storage.py
@@ -5,7 +5,7 @@ import libvirttest
 
 class TestStoragePool(libvirttest.BaseTestClass):
     def test_storage_pool_autostart(self):
-        _, test_storage_pool = self.test_storage_pool()
+        _, test_storage_pool = self.get_test_storage_pool()
         interface_obj = dbus.Interface(test_storage_pool,
                                        'org.libvirt.StoragePool')
         autostart_expected = True
@@ -18,7 +18,7 @@ class TestStoragePool(libvirttest.BaseTestClass):
         assert autostart_current == dbus.Boolean(autostart_expected)
 
     def test_storage_pool_build(self):
-        _, test_storage_pool = self.test_storage_pool()
+        _, test_storage_pool = self.get_test_storage_pool()
         interface_obj = dbus.Interface(test_storage_pool,
                                        'org.libvirt.StoragePool')
         interface_obj.Destroy()
@@ -33,7 +33,7 @@ class TestStoragePool(libvirttest.BaseTestClass):
 
         self.connect.connect_to_signal('StoragePoolEvent', storage_pool_started)
 
-        _, test_storage_pool = self.test_storage_pool()
+        _, test_storage_pool = self.get_test_storage_pool()
         interface_obj = dbus.Interface(test_storage_pool,
                                        'org.libvirt.StoragePool')
         interface_obj.Destroy()
@@ -42,7 +42,7 @@ class TestStoragePool(libvirttest.BaseTestClass):
         self.main_loop()
 
     def test_storage_pool_delete(self):
-        _, test_storage_pool = self.test_storage_pool()
+        _, test_storage_pool = self.get_test_storage_pool()
         interface_obj = dbus.Interface(test_storage_pool,
                                        'org.libvirt.StoragePool')
         interface_obj.Destroy()
@@ -58,7 +58,7 @@ class TestStoragePool(libvirttest.BaseTestClass):
         self.connect.connect_to_signal('StoragePoolEvent',
                                        storage_pool_destroyed)
 
-        _, test_storage_pool = self.test_storage_pool()
+        _, test_storage_pool = self.get_test_storage_pool()
         interface_obj = dbus.Interface(test_storage_pool,
                                        'org.libvirt.StoragePool')
         interface_obj.Destroy()
@@ -66,21 +66,21 @@ class TestStoragePool(libvirttest.BaseTestClass):
         self.main_loop()
 
     def test_storage_pool_get_info(self):
-        _, test_storage_pool = self.test_storage_pool()
+        _, test_storage_pool = self.get_test_storage_pool()
         interface_obj = dbus.Interface(test_storage_pool,
                                        'org.libvirt.StoragePool')
         info = interface_obj.GetInfo()
         assert isinstance(info, dbus.Struct)
 
     def test_storage_pool_get_xml_description(self):
-        _, test_storage_pool = self.test_storage_pool()
+        _, test_storage_pool = self.get_test_storage_pool()
         interface_obj = dbus.Interface(test_storage_pool,
                                        'org.libvirt.StoragePool')
         info = interface_obj.GetXMLDesc(0)
         assert isinstance(info, dbus.String)
 
     def test_storage_pool_list_storage_volumes(self):
-        _, test_storage_pool = self.test_storage_pool()
+        _, test_storage_pool = self.get_test_storage_pool()
         interface_obj = dbus.Interface(test_storage_pool,
                                        'org.libvirt.StoragePool')
         storage_vols = interface_obj.ListStorageVolumes(0)
@@ -88,7 +88,7 @@ class TestStoragePool(libvirttest.BaseTestClass):
         assert len(storage_vols) == 0
 
     def test_storage_pool_properties_type(self):
-        _, obj = self.test_storage_pool()
+        _, obj = self.get_test_storage_pool()
 
         props = obj.GetAll('org.libvirt.StoragePool',
                            dbus_interface=dbus.PROPERTIES_IFACE)
@@ -108,7 +108,7 @@ class TestStoragePool(libvirttest.BaseTestClass):
         self.connect.connect_to_signal('StoragePoolEvent',
                                        storage_pool_undefined)
 
-        _, test_storage_pool = self.test_storage_pool()
+        _, test_storage_pool = self.get_test_storage_pool()
         interface_obj = dbus.Interface(test_storage_pool,
                                        'org.libvirt.StoragePool')
         interface_obj.Destroy()
@@ -117,7 +117,7 @@ class TestStoragePool(libvirttest.BaseTestClass):
         self.main_loop()
 
     def test_storage_pool_refresh(self):
-        _, test_storage_pool = self.test_storage_pool()
+        _, test_storage_pool = self.get_test_storage_pool()
         interface_obj = dbus.Interface(test_storage_pool,
                                        'org.libvirt.StoragePool')
         interface_obj.connect_to_signal('Refresh',
-- 
2.15.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux