Testing with API added

This commit is contained in:
Vladimir Repin
2022-10-29 18:26:28 +03:00
parent 35c45df28b
commit af45b5a11a
4 changed files with 112 additions and 0 deletions

17
test/server_poll.py Normal file
View File

@@ -0,0 +1,17 @@
import unittest
import requests
import time
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")