change ble test add cli arg
This commit is contained in:
1 parent
47bbc78e56
commit
aa8b99ac13
1 file changed
+15
-3
+15
-3
@@ -266,11 +266,23 @@ def test(test_count = 0) -> None:
|
||||
# --------------------------------------------------------------------------- #
|
||||
if __name__ == "__main__":
|
||||
import json
|
||||
import sys
|
||||
# 1. Grab the argument (string)
|
||||
if len(sys.argv) < 2:
|
||||
print("Usage: python3 test.py <count>")
|
||||
sys.exit(1)
|
||||
|
||||
try:
|
||||
count = int(sys.argv[1]) # convert to integer
|
||||
except ValueError:
|
||||
print("The count must be an integer.")
|
||||
sys.exit(1)
|
||||
|
||||
test_count = 0
|
||||
print("Welp, this will keep going forever. Have fun :)")
|
||||
while True:
|
||||
print(f"Starting BLE Test for {count} iterations")
|
||||
while test_count <= count:
|
||||
test_count = test_count + 1
|
||||
print(f"Starting test run {test_count}")
|
||||
print(f"Starting test run {test_count} of {count}")
|
||||
try:
|
||||
test(test_count)
|
||||
except Exception as e:
|
||||
|
||||
Reference in new issue
Block a user