Merge pull request #8197 from aabadie/pr/tests/python_E711

tests/lwip: fix python E711 comparison to None should be 'if cond is not None:'
This commit is contained in:
Martine Lenders 2017-12-04 13:57:41 +01:00 committed by GitHub
commit ae8b426897
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -20,7 +20,7 @@ DEFAULT_TIMEOUT = 5
class Strategy(object): class Strategy(object):
def __init__(self, func=None): def __init__(self, func=None):
if func != None: if func is not None:
if sys.version_info < (3,): if sys.version_info < (3,):
self.__class__.execute = types.MethodType(func, self, self.__class__) self.__class__.execute = types.MethodType(func, self, self.__class__)
else: else:
@ -43,7 +43,7 @@ class BoardStrategy(Strategy):
def __run_make(self, application, make_targets, env=None): def __run_make(self, application, make_targets, env=None):
env = os.environ.copy() env = os.environ.copy()
if env != None: if env is not None:
env.update(env) env.update(env)
env.update(self.board.to_env()) env.update(self.board.to_env())
cmd = ("make", "-C", application) + make_targets cmd = ("make", "-C", application) + make_targets
@ -81,7 +81,7 @@ class Board(object):
def _reset_native_execute(obj, application, env=None, *args, **kwargs): def _reset_native_execute(obj, application, env=None, *args, **kwargs):
pass pass
if (name == "native") and (reset == None): if (name == "native") and (reset is None):
reset = _reset_native_execute reset = _reset_native_execute
self.name = name self.name = name
@ -161,7 +161,7 @@ class BoardGroup(object):
def default_test_case(board_group, application, env=None): def default_test_case(board_group, application, env=None):
for board in board_group: for board in board_group:
env = os.environ.copy() env = os.environ.copy()
if env != None: if env is not None:
env.update(env) env.update(env)
env.update(board.to_env()) env.update(board.to_env())
with pexpect.spawnu("make", ["-C", application, "term"], env=env, with pexpect.spawnu("make", ["-C", application, "term"], env=env,
@ -191,11 +191,11 @@ def get_ipv6_address(spawn):
def test_ipv6_send(board_group, application, env=None): def test_ipv6_send(board_group, application, env=None):
env_sender = os.environ.copy() env_sender = os.environ.copy()
if env != None: if env is not None:
env_sender.update(env) env_sender.update(env)
env_sender.update(board_group.boards[0].to_env()) env_sender.update(board_group.boards[0].to_env())
env_receiver = os.environ.copy() env_receiver = os.environ.copy()
if env != None: if env is not None:
env_receiver.update(env) env_receiver.update(env)
env_receiver.update(board_group.boards[1].to_env()) env_receiver.update(board_group.boards[1].to_env())
with pexpect.spawnu("make", ["-C", application, "term"], env=env_sender, with pexpect.spawnu("make", ["-C", application, "term"], env=env_sender,
@ -215,11 +215,11 @@ def test_ipv6_send(board_group, application, env=None):
def test_udpv6_send(board_group, application, env=None): def test_udpv6_send(board_group, application, env=None):
env_sender = os.environ.copy() env_sender = os.environ.copy()
if env != None: if env is not None:
env_sender.update(env) env_sender.update(env)
env_sender.update(board_group.boards[0].to_env()) env_sender.update(board_group.boards[0].to_env())
env_receiver = os.environ.copy() env_receiver = os.environ.copy()
if env != None: if env is not None:
env_receiver.update(env) env_receiver.update(env)
env_receiver.update(board_group.boards[1].to_env()) env_receiver.update(board_group.boards[1].to_env())
with pexpect.spawnu("make", ["-C", application, "term"], env=env_sender, with pexpect.spawnu("make", ["-C", application, "term"], env=env_sender,
@ -240,11 +240,11 @@ def test_udpv6_send(board_group, application, env=None):
def test_tcpv6_send(board_group, application, env=None): def test_tcpv6_send(board_group, application, env=None):
env_client = os.environ.copy() env_client = os.environ.copy()
if env != None: if env is not None:
env_client.update(env) env_client.update(env)
env_client.update(board_group.boards[0].to_env()) env_client.update(board_group.boards[0].to_env())
env_server = os.environ.copy() env_server = os.environ.copy()
if env != None: if env is not None:
env_server.update(env) env_server.update(env)
env_server.update(board_group.boards[1].to_env()) env_server.update(board_group.boards[1].to_env())
with pexpect.spawnu("make", ["-C", application, "term"], env=env_client, with pexpect.spawnu("make", ["-C", application, "term"], env=env_client,
@ -270,11 +270,11 @@ def test_tcpv6_send(board_group, application, env=None):
def test_triple_send(board_group, application, env=None): def test_triple_send(board_group, application, env=None):
env_sender = os.environ.copy() env_sender = os.environ.copy()
if env != None: if env is not None:
env_sender.update(env) env_sender.update(env)
env_sender.update(board_group.boards[0].to_env()) env_sender.update(board_group.boards[0].to_env())
env_receiver = os.environ.copy() env_receiver = os.environ.copy()
if env != None: if env is not None:
env_receiver.update(env) env_receiver.update(env)
env_receiver.update(board_group.boards[1].to_env()) env_receiver.update(board_group.boards[1].to_env())
with pexpect.spawnu("make", ["-C", application, "term"], env=env_sender, with pexpect.spawnu("make", ["-C", application, "term"], env=env_sender,