2022-10-29 15:26:28 +00:00
|
|
|
import unittest
|
|
|
|
import requests
|
|
|
|
import time
|
|
|
|
|
2022-10-30 05:22:44 +00:00
|
|
|
|
|
|
|
def run_tests():
|
|
|
|
timeout_threshold = 240
|
|
|
|
start_time = time.time()
|
|
|
|
while time.time()-start_time < timeout_threshold:
|
|
|
|
try:
|
|
|
|
requests.head("http://localhost:7860/")
|
|
|
|
break
|
|
|
|
except requests.exceptions.ConnectionError:
|
|
|
|
pass
|
|
|
|
if time.time()-start_time < timeout_threshold:
|
|
|
|
suite = unittest.TestLoader().discover('', pattern='*_test.py')
|
|
|
|
result = unittest.TextTestRunner(verbosity=2).run(suite)
|
|
|
|
else:
|
|
|
|
print("Launch unsuccessful")
|