From nobody Wed May 14 02:54:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1528992032354380.68565530211913; Thu, 14 Jun 2018 09:00:32 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AB0CA61D22; Thu, 14 Jun 2018 16:00:30 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 68E8B10A4B28; Thu, 14 Jun 2018 16:00:30 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 085DF18037F2; Thu, 14 Jun 2018 16:00:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w5EG01PJ003750 for ; Thu, 14 Jun 2018 12:00:01 -0400 Received: by smtp.corp.redhat.com (Postfix) id E65B610FFE52; Thu, 14 Jun 2018 16:00:00 +0000 (UTC) Received: from katerina.brq.redhat.com (unknown [10.43.2.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6AB3910FFE4D for ; Thu, 14 Jun 2018 16:00:00 +0000 (UTC) From: Katerina Koukiou To: libvir-list@redhat.com Date: Thu, 14 Jun 2018 17:59:40 +0200 Message-Id: <20180614155953.30292-5-kkoukiou@redhat.com> In-Reply-To: <20180614155953.30292-1-kkoukiou@redhat.com> References: <20180614155953.30292-1-kkoukiou@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Subject: [libvirt] [dbus PATCH v2 04/17] tests: rename test_* functions which are not tests X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 14 Jun 2018 16:00:31 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Pavel Hrdina --- 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() =20 - def domain(self): + def get_test_domain(self): path =3D self.connect.ListDomains(0)[0] obj =3D self.bus.get_object('org.libvirt', path) return obj, dbus.Interface(obj, 'org.libvirt.Domain') =20 - def test_network(self): + def get_test_network(self): """Fetch information for the test network from test driver =20 Returns: @@ -87,7 +87,7 @@ class BaseTestClass(): obj =3D self.bus.get_object('org.libvirt', path) return path, obj =20 - def test_storage_pool(self): + def get_test_storage_pool(self): """Fetch information for the test storage pool from test driver =20 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 =3D self.connect.ListDomains(0)[0] - obj, _ =3D self.domain() + obj, _ =3D self.get_test_domain() props =3D obj.GetAll('org.libvirt.Domain', dbus_interface=3Ddbus.P= ROPERTIES_IFACE) path =3D getattr(self.connect, lookup_method_name)(props[lookup_it= em]) assert original_path =3D=3D 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 Connec= t interface """ - original_path, obj =3D self.test_network() + original_path, obj =3D self.get_test_network() prop =3D obj.Get('org.libvirt.Network', lookup_item, dbus_interfac= e=3Ddbus.PROPERTIES_IFACE) path =3D getattr(self.connect, lookup_method_name)(prop) assert original_path =3D=3D path @@ -206,7 +206,7 @@ class TestConnect(libvirttest.BaseTestClass): lookup_item): """Parameterized test for all StoragePoolLookupBy* API calls of Co= nnect interface """ - original_path, obj =3D self.test_storage_pool() + original_path, obj =3D self.get_test_storage_pool() prop =3D obj.Get('org.libvirt.StoragePool', lookup_item, dbus_interface=3Ddbus.PROPERTIES_IFACE) path =3D 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 =3D 'this function is not s= upported by the connect =20 class TestDomain(libvirttest.BaseTestClass): def test_api(self): - obj, domain =3D self.domain() + obj, domain =3D self.get_test_domain() =20 props =3D obj.GetAll('org.libvirt.Domain', dbus_interface=3Ddbus.P= ROPERTIES_IFACE) assert isinstance(props['Active'], dbus.Boolean) @@ -39,7 +39,7 @@ class TestDomain(libvirttest.BaseTestClass): domain.Undefine(0) =20 def test_domain_autostart(self): - _, domain =3D self.domain() + _, domain =3D self.get_test_domain() autostart_expected =3D True domain.Set('org.libvirt.Domain', 'Autostart', autostart_expected, = dbus_interface=3Ddbus.PROPERTIES_IFACE) autostart_current =3D domain.Get('org.libvirt.Domain', 'Autostart'= , dbus_interface=3Ddbus.PROPERTIES_IFACE) @@ -55,7 +55,7 @@ class TestDomain(libvirttest.BaseTestClass): =20 self.connect.connect_to_signal('DomainEvent', domain_stopped) =20 - obj, domain =3D self.domain() + obj, domain =3D self.get_test_domain() domain.ManagedSave(0) assert domain.HasManagedSaveImage(0) =3D=3D dbus.Boolean(True) state, _ =3D domain.GetState(0) @@ -67,7 +67,7 @@ class TestDomain(libvirttest.BaseTestClass): =20 def test_domain_metadata(self): metadata_description =3D 0 - obj, domain =3D self.domain() + obj, domain =3D self.get_test_domain() description_expected =3D "This is the Test domain" domain.SetMetadata(metadata_description, description_expected, "", "", 0) @@ -83,7 +83,7 @@ class TestDomain(libvirttest.BaseTestClass): =20 self.connect.connect_to_signal('DomainEvent', domain_resumed) =20 - obj, domain =3D self.domain() + obj, domain =3D self.get_test_domain() domain.Suspend() domain.Resume() =20 @@ -102,7 +102,7 @@ class TestDomain(libvirttest.BaseTestClass): =20 self.connect.connect_to_signal('DomainEvent', domain_stopped) =20 - obj, domain =3D self.domain() + obj, domain =3D self.get_test_domain() domain.Shutdown(0) =20 state, _ =3D domain.GetState(0) @@ -120,7 +120,7 @@ class TestDomain(libvirttest.BaseTestClass): =20 self.connect.connect_to_signal('DomainEvent', domain_suspended) =20 - obj, domain =3D self.domain() + obj, domain =3D self.get_test_domain() domain.Suspend() =20 state, _ =3D domain.GetState(0) @@ -138,20 +138,20 @@ class TestDomain(libvirttest.BaseTestClass): =20 self.connect.connect_to_signal('DomainEvent', domain_undefined) =20 - _, domain =3D self.domain() + _, domain =3D self.get_test_domain() domain.Shutdown(0) domain.Undefine(0) =20 self.main_loop() =20 def test_domain_vcpus(self): - obj, domain =3D self.domain() + obj, domain =3D self.get_test_domain() vcpus_expected =3D 2 domain.SetVcpus(vcpus_expected, 0) assert domain.GetVcpus(0) =3D=3D dbus.Int32(vcpus_expected) =20 def test_domain_vcpu_pin_info(self): - obj, domain =3D self.domain() + obj, domain =3D self.get_test_domain() pinInfo_expected =3D [ [ 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 =3D self.test_network() + _, obj =3D self.get_test_network() props =3D obj.GetAll('org.libvirt.Network', dbus_interface=3Ddbus.= 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) =20 def test_network_autostart(self): - _,test_network =3D self.test_network() + _,test_network =3D self.get_test_network() interface_obj =3D dbus.Interface(test_network, 'org.libvirt.Networ= k') autostart_expected =3D True interface_obj.Set('org.libvirt.Network', 'Autostart', autostart_ex= pected, dbus_interface=3Ddbus.PROPERTIES_IFACE) @@ -41,7 +41,7 @@ class TestNetwork(libvirttest.BaseTestClass): =20 self.connect.connect_to_signal('NetworkEvent', domain_started) =20 - _,test_network =3D self.test_network() + _,test_network =3D self.get_test_network() interface_obj =3D dbus.Interface(test_network, 'org.libvirt.Networ= k') interface_obj.Destroy() interface_obj.Create() @@ -57,14 +57,14 @@ class TestNetwork(libvirttest.BaseTestClass): =20 self.connect.connect_to_signal('NetworkEvent', network_stopped) =20 - _, test_network =3D self.test_network() + _, test_network =3D self.get_test_network() interface_obj =3D dbus.Interface(test_network, 'org.libvirt.Networ= k') interface_obj.Destroy() =20 self.main_loop() =20 def test_network_get_xml_description(self): - _,test_network =3D self.test_network() + _,test_network =3D self.get_test_network() interface_obj =3D dbus.Interface(test_network, 'org.libvirt.Networ= k') assert isinstance(interface_obj.GetXMLDesc(0), dbus.String) =20 @@ -77,7 +77,7 @@ class TestNetwork(libvirttest.BaseTestClass): =20 self.connect.connect_to_signal('NetworkEvent', domain_undefined) =20 - _,test_network =3D self.test_network() + _,test_network =3D self.get_test_network() interface_obj =3D dbus.Interface(test_network, 'org.libvirt.Networ= k') 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 =3D self.test_network() + _, test_network =3D self.get_test_network() interface_obj =3D dbus.Interface(test_network, 'org.libvirt.Networ= k') interface_obj.Update(command, section, parentIndex, xml_str, flags) updated_netxml =3D 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 =20 class TestStoragePool(libvirttest.BaseTestClass): def test_storage_pool_autostart(self): - _, test_storage_pool =3D self.test_storage_pool() + _, test_storage_pool =3D self.get_test_storage_pool() interface_obj =3D dbus.Interface(test_storage_pool, 'org.libvirt.StoragePool') autostart_expected =3D True @@ -18,7 +18,7 @@ class TestStoragePool(libvirttest.BaseTestClass): assert autostart_current =3D=3D dbus.Boolean(autostart_expected) =20 def test_storage_pool_build(self): - _, test_storage_pool =3D self.test_storage_pool() + _, test_storage_pool =3D self.get_test_storage_pool() interface_obj =3D dbus.Interface(test_storage_pool, 'org.libvirt.StoragePool') interface_obj.Destroy() @@ -33,7 +33,7 @@ class TestStoragePool(libvirttest.BaseTestClass): =20 self.connect.connect_to_signal('StoragePoolEvent', storage_pool_st= arted) =20 - _, test_storage_pool =3D self.test_storage_pool() + _, test_storage_pool =3D self.get_test_storage_pool() interface_obj =3D dbus.Interface(test_storage_pool, 'org.libvirt.StoragePool') interface_obj.Destroy() @@ -42,7 +42,7 @@ class TestStoragePool(libvirttest.BaseTestClass): self.main_loop() =20 def test_storage_pool_delete(self): - _, test_storage_pool =3D self.test_storage_pool() + _, test_storage_pool =3D self.get_test_storage_pool() interface_obj =3D 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) =20 - _, test_storage_pool =3D self.test_storage_pool() + _, test_storage_pool =3D self.get_test_storage_pool() interface_obj =3D dbus.Interface(test_storage_pool, 'org.libvirt.StoragePool') interface_obj.Destroy() @@ -66,21 +66,21 @@ class TestStoragePool(libvirttest.BaseTestClass): self.main_loop() =20 def test_storage_pool_get_info(self): - _, test_storage_pool =3D self.test_storage_pool() + _, test_storage_pool =3D self.get_test_storage_pool() interface_obj =3D dbus.Interface(test_storage_pool, 'org.libvirt.StoragePool') info =3D interface_obj.GetInfo() assert isinstance(info, dbus.Struct) =20 def test_storage_pool_get_xml_description(self): - _, test_storage_pool =3D self.test_storage_pool() + _, test_storage_pool =3D self.get_test_storage_pool() interface_obj =3D dbus.Interface(test_storage_pool, 'org.libvirt.StoragePool') info =3D interface_obj.GetXMLDesc(0) assert isinstance(info, dbus.String) =20 def test_storage_pool_list_storage_volumes(self): - _, test_storage_pool =3D self.test_storage_pool() + _, test_storage_pool =3D self.get_test_storage_pool() interface_obj =3D dbus.Interface(test_storage_pool, 'org.libvirt.StoragePool') storage_vols =3D interface_obj.ListStorageVolumes(0) @@ -88,7 +88,7 @@ class TestStoragePool(libvirttest.BaseTestClass): assert len(storage_vols) =3D=3D 0 =20 def test_storage_pool_properties_type(self): - _, obj =3D self.test_storage_pool() + _, obj =3D self.get_test_storage_pool() =20 props =3D obj.GetAll('org.libvirt.StoragePool', dbus_interface=3Ddbus.PROPERTIES_IFACE) @@ -108,7 +108,7 @@ class TestStoragePool(libvirttest.BaseTestClass): self.connect.connect_to_signal('StoragePoolEvent', storage_pool_undefined) =20 - _, test_storage_pool =3D self.test_storage_pool() + _, test_storage_pool =3D self.get_test_storage_pool() interface_obj =3D dbus.Interface(test_storage_pool, 'org.libvirt.StoragePool') interface_obj.Destroy() @@ -117,7 +117,7 @@ class TestStoragePool(libvirttest.BaseTestClass): self.main_loop() =20 def test_storage_pool_refresh(self): - _, test_storage_pool =3D self.test_storage_pool() + _, test_storage_pool =3D self.get_test_storage_pool() interface_obj =3D dbus.Interface(test_storage_pool, 'org.libvirt.StoragePool') interface_obj.connect_to_signal('Refresh', --=20 2.15.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list