From nobody Fri May 3 16:32:12 2024 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 1532611321388823.5603165361771; Thu, 26 Jul 2018 06:22:01 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E8BC3859FF; Thu, 26 Jul 2018 13:21:49 +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 4997A61D01; Thu, 26 Jul 2018 13:21:49 +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 33BA318037F0; Thu, 26 Jul 2018 13:21:46 +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 w6QDKsUb021449 for ; Thu, 26 Jul 2018 09:20:55 -0400 Received: by smtp.corp.redhat.com (Postfix) id C65AB1102E26; Thu, 26 Jul 2018 13:20:54 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.40.205.69]) by smtp.corp.redhat.com (Postfix) with ESMTP id 491811102E1F for ; Thu, 26 Jul 2018 13:20:54 +0000 (UTC) From: Katerina Koukiou To: libvir-list@redhat.com Date: Thu, 26 Jul 2018 15:20:48 +0200 Message-Id: <20180726132049.4362-2-kkoukiou@redhat.com> In-Reply-To: <20180726132049.4362-1-kkoukiou@redhat.com> References: <20180726132049.4362-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 1/2] tests: fix all coding style issues to comply with flake8 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.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 26 Jul 2018 13:22:00 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Katerina Koukiou Reviewed-by: J=EF=BF=BDn Tomko --- 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 =3D interface_obj.StorageVolCreateXML(xmldata.minimal_storage= _vol_xml, 0) yield path =20 - def get_test_domain(self): path =3D self.connect.ListDomains(0)[0] obj =3D self.bus.get_object('org.libvirt', path) @@ -196,7 +195,7 @@ class DomainEventStoppedDetailType(IntEnum): SHUTDOWN =3D 0 DESTROYED =3D 1 CRASHED =3D 2 - MIGRATED =3D 3 + MIGRATED =3D 3 SAVED =3D 4 FAILED =3D 5 FROM_SNAPSHOT =3D 6 @@ -205,9 +204,9 @@ class DomainEventStoppedDetailType(IntEnum): =20 class DomainEventSuspendedDetailType(IntEnum): PAUSED =3D 0 - MIGRATED =3D 1 + MIGRATED =3D 1 IOERROR =3D 2 - WATCHDOG =3D 3 + WATCHDOG =3D 3 RESTORED =3D 4 FROM_SNAPSHOT =3D 5 API_ERROR =3D 6 @@ -240,10 +239,12 @@ class NetworkEvent(IntEnum): STARTED =3D 2 STOPPED =3D 3 =20 + class NodeDeviceEvent(IntEnum): CREATED =3D 0 DELETED =3D 1 =20 + class StoragePoolBuildFlags(IntEnum): NEW =3D 0 REPAIR =3D 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 Conn= ect interface """ - original_path,_ =3D interface_create + original_path, _ =3D interface_create obj =3D self.bus.get_object('org.libvirt', original_path) prop =3D obj.Get('org.libvirt.Interface', lookup_item, dbus_interf= ace=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 b9a6d33..b5879b4 100755 --- a/tests/test_domain.py +++ b/tests/test_domain.py @@ -5,6 +5,7 @@ import libvirttest =20 DBUS_EXCEPTION_MISSING_FUNCTION =3D 'this function is not supported by the= connection driver' =20 + class TestDomain(libvirttest.BaseTestClass): def test_api(self): obj, domain =3D self.get_test_domain() @@ -153,8 +154,8 @@ class TestDomain(libvirttest.BaseTestClass): def test_domain_vcpu_pin_info(self): 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 ] + [True, True, True, True, True, True, True, True], + [True, True, True, True, True, True, True, True] ] pinInfo =3D domain.GetVcpuPinInfo(0) assert pinInfo =3D=3D 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 =20 + @pytest.mark.usefixtures("interface_create") class TestInterface(libvirttest.BaseTestClass): """ Tests for methods and properties of the Interface interface """ =20 def test_interface_undefine(self, interface_create): - _,interface_obj =3D interface_create + _, interface_obj =3D interface_create interface_obj.Destroy(0) interface_obj.Undefine() =20 def test_interface_destroy(self, interface_create): - _,interface_obj =3D interface_create + _, interface_obj =3D interface_create interface_obj.Destroy(0) =20 def test_interface_create(self, interface_create): - _,interface_obj =3D interface_create + _, interface_obj =3D interface_create interface_obj.Destroy(0) interface_obj.Create(0) =20 def test_interface_get_xml_description(self, interface_create): - _,interface_obj =3D interface_create + _, interface_obj =3D interface_create assert isinstance(interface_obj.GetXMLDesc(0), dbus.String) =20 def test_interface_properties_type(self, interface_create): """ Ensure correct return type for Interface properties """ - test_interface_path,_ =3D interface_create + test_interface_path, _ =3D interface_create obj =3D self.bus.get_object('org.libvirt', test_interface_path) props =3D obj.GetAll('org.libvirt.Interface', dbus_interface=3Ddbu= s.PROPERTIES_IFACE) assert isinstance(props['Name'], dbus.String) assert isinstance(props['MAC'], dbus.String) assert isinstance(props['Active'], dbus.Boolean) =20 + if __name__ =3D=3D '__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) =20 def test_network_autostart(self): - _,test_network =3D self.get_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.get_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() @@ -64,7 +64,7 @@ class TestNetwork(libvirttest.BaseTestClass): self.main_loop() =20 def test_network_get_xml_description(self): - _,test_network =3D self.get_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.get_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() 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 =20 + class TestStoragePool(libvirttest.BaseTestClass): def test_storage_pool_autostart(self): _, test_storage_pool =3D self.get_test_storage_pool() --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 16:32:12 2024 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 1532611315157283.61177894539026; Thu, 26 Jul 2018 06:21:55 -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 AE3633082268; Thu, 26 Jul 2018 13:21:53 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 56B8E108421B; Thu, 26 Jul 2018 13:21:53 +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 E26FE3FCC2; Thu, 26 Jul 2018 13:21:52 +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 w6QDKtdI021455 for ; Thu, 26 Jul 2018 09:20:55 -0400 Received: by smtp.corp.redhat.com (Postfix) id B6B971102E26; Thu, 26 Jul 2018 13:20:55 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.40.205.69]) by smtp.corp.redhat.com (Postfix) with ESMTP id 353C81102E1F for ; Thu, 26 Jul 2018 13:20:55 +0000 (UTC) From: Katerina Koukiou To: libvir-list@redhat.com Date: Thu, 26 Jul 2018 15:20:49 +0200 Message-Id: <20180726132049.4362-3-kkoukiou@redhat.com> In-Reply-To: <20180726132049.4362-1-kkoukiou@redhat.com> References: <20180726132049.4362-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 2/2] Add syntax-check target in Makefile.am 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.45]); Thu, 26 Jul 2018 13:21:54 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" For now syntax checking is performed only on the python files using flake8. E501: (line too long) warning is ignored. Signed-off-by: Katerina Koukiou Reviewed-by: J=EF=BF=BDn Tomko --- HACKING.md | 9 ++++++++- Makefile.am | 6 ++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/HACKING.md b/HACKING.md index bb22fd6..9327959 100644 --- a/HACKING.md +++ b/HACKING.md @@ -29,7 +29,7 @@ Running from git repository ``` =20 =20 - * Before posting a patch, you should run tests: + * Before posting a patch, you should run tests and perform syntax-checki= ng: =20 ``` make check @@ -37,6 +37,13 @@ Running from git repository =20 The test tool requires python3, python3-pytest and python3-dbus. =20 + ``` + make syntax-check + ``` + + Syntax checking currently is applied only on the python code. + To run this flake8 package is required. + =20 * To run libvirt-dbus directly from the build dir without installing it use the run script: diff --git a/Makefile.am b/Makefile.am index 2c9e588..5c95e96 100644 --- a/Makefile.am +++ b/Makefile.am @@ -42,3 +42,9 @@ gen-AUTHORS: mv -f $(distdir)/AUTHORS-tmp $(distdir)/AUTHORS && \ rm -f all.list maint.list contrib.list; \ fi + +.PHONY: flake8 +flake8: + flake8 --ignore=3DE501 + +syntax-check: flake8 --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list