diff options
author | AUTOMATIC <16777216c@gmail.com> | 2022-10-30 05:22:44 +0000 |
---|---|---|
committer | AUTOMATIC <16777216c@gmail.com> | 2022-10-30 05:22:44 +0000 |
commit | 59dfe0845d964868e92572c78a420b6d68c46ea4 (patch) | |
tree | c43ada96969bdcdb926da9a4009f827c40dfc612 /test/server_poll.py | |
parent | 05a657dd357eaca6940c4775daa946bd33f1167d (diff) | |
download | stable-diffusion-webui-gfx803-59dfe0845d964868e92572c78a420b6d68c46ea4.tar.gz stable-diffusion-webui-gfx803-59dfe0845d964868e92572c78a420b6d68c46ea4.tar.bz2 stable-diffusion-webui-gfx803-59dfe0845d964868e92572c78a420b6d68c46ea4.zip |
launch tests from launch.py with --tests commandline argument
Diffstat (limited to 'test/server_poll.py')
-rw-r--r-- | test/server_poll.py | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/test/server_poll.py b/test/server_poll.py index 8c0436f8..eeefb7eb 100644 --- a/test/server_poll.py +++ b/test/server_poll.py @@ -2,16 +2,18 @@ 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") + +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") |