Skip to content

Commit 730b75a

Browse files
committed
Use instance checks for True and False objects
Checking True or False by value makes no sense, they are not values. Instead we should check if we have an "instance" of the True or False objects.
1 parent 04e1f44 commit 730b75a

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/htrun/host_tests_conn_proxy/conn_proxy.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ def __send_sync(timeout=None):
269269
pass # Check if target sent something
270270
else:
271271
# Return if state machine in host_test_default has finished to end process
272-
if key == "__host_test_finished" and value == True:
272+
if key == "__host_test_finished" and value is True:
273273
logger.prn_inf(
274274
"received special event '%s' value='%s', finishing" % (key, value)
275275
)
@@ -351,7 +351,7 @@ def __send_sync(timeout=None):
351351
else:
352352
__notify_conn_lost()
353353
break
354-
elif last_sync == True:
354+
elif last_sync is True:
355355
# SYNC lost connection event : Device not responding, send sync failed
356356
__notify_sync_failed()
357357
break

src/htrun/host_tests_runner/host_test_default.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -612,9 +612,9 @@ def execute(self):
612612
# Execute test if flashing was successful or skipped
613613
test_result = self.run_test()
614614

615-
if test_result == True:
615+
if test_result is True:
616616
result = self.RESULT_SUCCESS
617-
elif test_result == False:
617+
elif test_result is False:
618618
result = self.RESULT_FAILURE
619619
elif test_result is None:
620620
result = self.RESULT_ERROR

src/htrun/host_tests_runner/target_base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,10 @@ def check_flash_error(target_id, disk, initial_remount_count):
172172
"mount_point" in mbed_target
173173
and mbed_target["mount_point"] is not None
174174
):
175-
if not initial_remount_count is None:
175+
if initial_remount_count is not None:
176176
new_remount_count = get_remount_count(disk)
177177
if (
178-
not new_remount_count is None
178+
new_remount_count is not None
179179
and new_remount_count == initial_remount_count
180180
):
181181
sleep(0.5)

0 commit comments

Comments
 (0)