use thread for testing

This commit is contained in:
geeksville
2020-05-01 22:48:33 -07:00
parent 6df00038bc
commit f4bdc07c22
2 changed files with 22 additions and 6 deletions

View File

@@ -3,6 +3,7 @@ from . import util
from . import StreamInterface
from pubsub import pub
import time
import threading
"""The interfaces we are using for our tests"""
interfaces = None
@@ -60,13 +61,13 @@ def testSend(fromInterface, toInterface):
return False
def startTests():
def testThread():
logging.info("Found devices, starting tests...")
while True:
global testNumber
testNumber = testNumber + 1
testSend(interfaces[0], interfaces[1])
time.sleep(20)
time.sleep(10)
def onConnection(topic=pub.AUTO_TOPIC):
@@ -76,7 +77,8 @@ def onConnection(topic=pub.AUTO_TOPIC):
global testsRunning
if (all(iface.isConnected for iface in interfaces) and not testsRunning):
testsRunning = True
startTests()
t = threading.Thread(target=testThread, args=())
t.start()
def openDebugLog(portName):