From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 12BDC5A89 for ; Tue, 13 Jan 2015 14:42:33 +0100 (CET) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga103.fm.intel.com with ESMTP; 13 Jan 2015 05:37:22 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.04,691,1406617200"; d="scan'208";a="511541157" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by orsmga003.jf.intel.com with ESMTP; 13 Jan 2015 05:36:24 -0800 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id t0DDgUY0012854; Tue, 13 Jan 2015 21:42:30 +0800 Received: from shecgisg004.sh.intel.com (localhost [127.0.0.1]) by shecgisg004.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id t0DDgSOR025851; Tue, 13 Jan 2015 21:42:30 +0800 Received: (from dayuqiu@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id t0DDgSBE025847; Tue, 13 Jan 2015 21:42:28 +0800 From: Michael Qiu To: dts@dpdk.org Date: Tue, 13 Jan 2015 21:42:15 +0800 Message-Id: <1421156540-25810-2-git-send-email-michael.qiu@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1421156540-25810-1-git-send-email-michael.qiu@intel.com> References: <1421156540-25810-1-git-send-email-michael.qiu@intel.com> Cc: yong.liu@intel.com Subject: [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: Tue, 13 Jan 2015 13:42:34 -0000 File "./framework/tester.py", line 110, in tester_prerequisites assert len(self.ports_map) > 0 TypeError: object of type 'NoneType' has no len() Currently ports_map is initialized with empty list, but it could be overridden by 'None' value. This patch solves this issue Signed-off-by: Michael Qiu --- framework/tester.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 == None or len(self.ports_map) == 0: + raise ValueError("ports_map should not be empty, please check all links") def get_local_port(self, remotePort): """ -- 1.9.3