diff options
author | AUTOMATIC1111 <16777216c@gmail.com> | 2023-01-04 15:39:57 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-04 15:39:57 +0000 |
commit | 37aafdb059fc038df7217a907048f7eb61f0beee (patch) | |
tree | 5ddecfd6d96d6bb1fea556a75fff58782ffcec3b /test/server_poll.py | |
parent | 4fbdbddc18b21f712acae58bf41740d27023285f (diff) | |
parent | a8eb9e3bf814f72293e474c11e9ff0098859a942 (diff) | |
download | stable-diffusion-webui-gfx803-37aafdb059fc038df7217a907048f7eb61f0beee.tar.gz stable-diffusion-webui-gfx803-37aafdb059fc038df7217a907048f7eb61f0beee.tar.bz2 stable-diffusion-webui-gfx803-37aafdb059fc038df7217a907048f7eb61f0beee.zip |
Merge branch 'master' into master
Diffstat (limited to 'test/server_poll.py')
-rw-r--r-- | test/server_poll.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/server_poll.py b/test/server_poll.py new file mode 100644 index 00000000..d4df697b --- /dev/null +++ b/test/server_poll.py @@ -0,0 +1,24 @@ +import unittest +import requests +import time + + +def run_tests(proc, test_dir): + 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: + 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 |