aboutsummaryrefslogtreecommitdiff
path: root/test/server_poll.py
diff options
context:
space:
mode:
authorAUTOMATIC1111 <16777216c@gmail.com>2022-11-27 16:40:26 +0300
committerGitHub <noreply@github.com>2022-11-27 16:40:26 +0300
commit8c8ad93bb5f01341513ce4b694f02d650edf0e80 (patch)
treef406e43d45b4c83860a39d5c2f6382772699f4bd /test/server_poll.py
parentb24aed0b69e55285e9f0dcc4495d1b22e96ee1dc (diff)
parent14dfede8ddbf6b82bb290d5c4292d52b6b68e3ca (diff)
Merge pull request #4635 from mezotaken/master
CI tests with github-actions and some improvements to testing
Diffstat (limited to 'test/server_poll.py')
-rw-r--r--test/server_poll.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/test/server_poll.py b/test/server_poll.py
index eeefb7eb..d4df697b 100644
--- a/test/server_poll.py
+++ b/test/server_poll.py
@@ -3,7 +3,7 @@ import requests
import time
-def run_tests():
+def run_tests(proc, test_dir):
timeout_threshold = 240
start_time = time.time()
while time.time()-start_time < timeout_threshold:
@@ -11,9 +11,14 @@ def run_tests():
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')
+ if proc.poll() is not None:
+ break
+ if proc.poll() is None:
+ if test_dir is None:
+ test_dir = ""
+ suite = unittest.TestLoader().discover(test_dir, pattern="*_test.py", top_level_dir="test")
result = unittest.TextTestRunner(verbosity=2).run(suite)
+ return len(result.failures) + len(result.errors)
else:
print("Launch unsuccessful")
+ return 1