[dts] [PATCH 1/6] framework/tester: Fix NoneType Error of port_map

Liu, Yong yong.liu at intel.com
Sun Jan 25 02:07:33 CET 2015


Applied. Thanks.

> -----Original Message-----
> From: Qiu, Michael
> Sent: Tuesday, January 13, 2015 9:42 PM
> To: dts at dpdk.org
> Cc: Liu, Yong; Qiu, Michael
> Subject: [PATCH 1/6] framework/tester: Fix NoneType Error of port_map
> 
> 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 <michael.qiu at intel.com>
> ---
>  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



More information about the dts mailing list