Skip to content

Commit

Permalink
Cleanup loop
Browse files Browse the repository at this point in the history
  • Loading branch information
sosthene-nitrokey committed Aug 17, 2023
1 parent 015c18b commit e0937a4
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions pynitrokey/cli/nk3/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,21 +374,22 @@ def internal_se050_run(q: Queue[Optional[bytes]]) -> None:

t = Thread(target=internal_se050_run, args=[que])
t.start()
total = 900
bar = tqdm(
desc="Running SE050 test", unit="%", bar_format="{l_bar}{bar}", total=900
desc="Running SE050 test", unit="%", bar_format="{l_bar}{bar}", total=total
)
# 1m30 in increments of 0.1 second
for i in range(900):
for i in range(total):
t.join(0.1)
bar.update(1)
if not t.is_alive():
break
if i == 900 - 1:
bar.close()
return TestResult(
TestStatus.FAILURE,
"Test timed out after 1m30",
)
else:
bar.close()
return TestResult(
TestStatus.FAILURE,
"Test timed out after 1m30",
)

bar.close()
result = que.get()
Expand Down

0 comments on commit e0937a4

Please sign in to comment.