diff options
author | AUTOMATIC1111 <16777216c@gmail.com> | 2023-05-19 15:59:31 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-19 15:59:31 +0000 |
commit | 0d84055eb6a3a22f33b606b8c73bd424116692e5 (patch) | |
tree | bea9851f5f1ae4a5378dd12f7335d7d0a8a0f402 /launch.py | |
parent | 9a86932c8bbac06afc70ea190399e767763d877e (diff) | |
parent | 793a491923ba11adbe1024e0eb0402923165dafa (diff) | |
download | stable-diffusion-webui-gfx803-0d84055eb6a3a22f33b606b8c73bd424116692e5.tar.gz stable-diffusion-webui-gfx803-0d84055eb6a3a22f33b606b8c73bd424116692e5.tar.bz2 stable-diffusion-webui-gfx803-0d84055eb6a3a22f33b606b8c73bd424116692e5.zip |
Merge pull request #10291 from akx/test-overhaul
Test overhaul
Diffstat (limited to 'launch.py')
-rw-r--r-- | launch.py | 32 |
1 files changed, 12 insertions, 20 deletions
@@ -310,12 +310,8 @@ def prepare_environment(): print("Exiting because of --exit argument")
exit(0)
- if args.tests and not args.no_tests:
- exitcode = tests(args.tests)
- exit(exitcode)
-
-def tests(test_dir):
+def configure_for_tests():
if "--api" not in sys.argv:
sys.argv.append("--api")
if "--ckpt" not in sys.argv:
@@ -325,21 +321,8 @@ def tests(test_dir): sys.argv.append("--skip-torch-cuda-test")
if "--disable-nan-check" not in sys.argv:
sys.argv.append("--disable-nan-check")
- if "--no-tests" not in sys.argv:
- sys.argv.append("--no-tests")
-
- print(f"Launching Web UI in another process for testing with arguments: {' '.join(sys.argv[1:])}")
os.environ['COMMANDLINE_ARGS'] = ""
- with open(os.path.join(script_path, 'test/stdout.txt'), "w", encoding="utf8") as stdout, open(os.path.join(script_path, 'test/stderr.txt'), "w", encoding="utf8") as stderr:
- proc = subprocess.Popen([sys.executable, *sys.argv], stdout=stdout, stderr=stderr)
-
- import test.server_poll
- exitcode = test.server_poll.run_tests(proc, test_dir)
-
- print(f"Stopping Web UI process with id {proc.pid}")
- proc.kill()
- return exitcode
def start():
@@ -351,6 +334,15 @@ def start(): webui.webui()
-if __name__ == "__main__":
- prepare_environment()
+def main():
+ if not args.skip_prepare_environment:
+ prepare_environment()
+
+ if args.test_server:
+ configure_for_tests()
+
start()
+
+
+if __name__ == "__main__":
+ main()
|