diff options
author | Muhammad Rizqi Nur <rizqinur2010@gmail.com> | 2022-10-30 18:57:51 +0700 |
---|---|---|
committer | Muhammad Rizqi Nur <rizqinur2010@gmail.com> | 2022-10-30 18:57:51 +0700 |
commit | cd4d59c0de446e6cae1db99ab1ad902b375a1e10 (patch) | |
tree | 8a09cbfceef69ebe3a3dab513a158a642923ab0c /test/server_poll.py | |
parent | 05e2e40537a948d7563d873ffbc394c41a0cd0b1 (diff) | |
parent | 17a2076f72562b428052ee3fc8c43d19c03ecd1e (diff) |
Merge master
Diffstat (limited to 'test/server_poll.py')
-rw-r--r-- | test/server_poll.py | 19 |
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") |