From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id EF065282 for ; Sun, 25 Jan 2015 02:07:38 +0100 (CET) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP; 24 Jan 2015 17:04:30 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,862,1389772800"; d="scan'208";a="444711870" Received: from pgsmsx104.gar.corp.intel.com ([10.221.44.91]) by FMSMGA003.fm.intel.com with ESMTP; 24 Jan 2015 16:54:04 -0800 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by PGSMSX104.gar.corp.intel.com (10.221.44.91) with Microsoft SMTP Server (TLS) id 14.3.195.1; Sun, 25 Jan 2015 09:07:35 +0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.192]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.173]) with mapi id 14.03.0195.001; Sun, 25 Jan 2015 09:07:34 +0800 From: "Liu, Yong" To: "Qiu, Michael" , "dts@dpdk.org" Thread-Topic: [PATCH 1/6] framework/tester: Fix NoneType Error of port_map Thread-Index: AQHQLzbNB/V+tTEyLU2B0XJ248x1cpzQGBxw Date: Sun, 25 Jan 2015 01:07:33 +0000 Message-ID: <86228AFD5BCD8E4EBFD2B90117B5E81E10D53374@SHSMSX103.ccr.corp.intel.com> References: <1421156540-25810-1-git-send-email-michael.qiu@intel.com> <1421156540-25810-2-git-send-email-michael.qiu@intel.com> In-Reply-To: <1421156540-25810-2-git-send-email-michael.qiu@intel.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dts] [PATCH 1/6] framework/tester: Fix NoneType Error of port_map X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Jan 2015 01:07:39 -0000 Applied. Thanks. > -----Original Message----- > From: Qiu, Michael > Sent: Tuesday, January 13, 2015 9:42 PM > To: dts@dpdk.org > Cc: Liu, Yong; Qiu, Michael > Subject: [PATCH 1/6] framework/tester: Fix NoneType Error of port_map >=20 > File "./framework/tester.py", line 110, in tester_prerequisites > assert len(self.ports_map) > 0 > TypeError: object of type 'NoneType' has no len() >=20 > Currently ports_map is initialized with empty list, > but it could be overridden by 'None' value. >=20 > This patch solves this issue >=20 > Signed-off-by: Michael Qiu > --- > framework/tester.py | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) >=20 > diff --git a/framework/tester.py b/framework/tester.py > index 2c023dd..d69503a 100644 > --- a/framework/tester.py > +++ b/framework/tester.py > @@ -125,7 +125,8 @@ class Tester(Crb): > self.restore_interfaces() > self.scan_ports() > self.map_available_ports() > - assert len(self.ports_map) > 0 > + if self.ports_map =3D=3D None or len(self.ports_map) =3D=3D 0: > + raise ValueError("ports_map should not be empty, please chec= k > all links") >=20 > def get_local_port(self, remotePort): > """ > -- > 1.9.3