aboutsummaryrefslogtreecommitdiff
path: root/test/server_poll.py
diff options
context:
space:
mode:
authorRoy Shilkrot <roy.shil@gmail.com>2022-10-31 11:45:52 -0400
committerRoy Shilkrot <roy.shil@gmail.com>2022-10-31 11:45:52 -0400
commit509fd1459bacfe0dcde1e5792ea3e046aa9f4d24 (patch)
treeeaecb0351d6a95e4c29eaebdcb8b304990fd3a91 /test/server_poll.py
parentbdc90837987ed8919dd611fd01553b0c170ded5c (diff)
parentdc7425a56e7a014cbfa3b3d44ad2321e519fe378 (diff)
Merge remote-tracking branch 'upstream/master' into roy.add_simple_interrogate_api
Diffstat (limited to 'test/server_poll.py')
-rw-r--r--test/server_poll.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/server_poll.py b/test/server_poll.py
new file mode 100644
index 00000000..eeefb7eb
--- /dev/null
+++ b/test/server_poll.py
@@ -0,0 +1,19 @@
+import unittest
+import requests
+import time
+
+
+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")