mirror of https://github.com/zulip/zulip.git
test-run-dev: Clean up some basic Python style.
This commit is contained in:
parent
ff8e588340
commit
8147897ac5
|
@ -1,22 +1,17 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
|
||||||
import time
|
|
||||||
import signal
|
import signal
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import sys
|
||||||
|
import time
|
||||||
from typing import Tuple
|
from typing import Tuple
|
||||||
|
|
||||||
# check for the venv
|
|
||||||
from lib import sanity_check
|
from lib import sanity_check
|
||||||
sanity_check.check_venv(__file__)
|
sanity_check.check_venv(__file__)
|
||||||
from typing import IO
|
|
||||||
|
|
||||||
|
|
||||||
TOOLS_DIR = os.path.dirname(os.path.abspath(__file__))
|
TOOLS_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
|
||||||
|
|
||||||
def start_server(logfile_name: str) -> Tuple[bool, str]:
|
def start_server(logfile_name: str) -> Tuple[bool, str]:
|
||||||
failure = True
|
failure = True
|
||||||
key = "Quit the server with CTRL-C."
|
key = "Quit the server with CTRL-C."
|
||||||
|
@ -35,26 +30,20 @@ def start_server(logfile_name: str) -> Tuple[bool, str]:
|
||||||
|
|
||||||
return failure, ''.join(datalog)
|
return failure, ''.join(datalog)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
print("Testing development server start!")
|
print("Testing development server start!")
|
||||||
|
|
||||||
logfile_name = '/tmp/run-dev-output'
|
logfile_name = '/tmp/run-dev-output'
|
||||||
logfile = open(logfile_name, 'wb', buffering=0)
|
with open(logfile_name, 'wb', buffering=0) as logfile:
|
||||||
|
run_dev = subprocess.Popen(
|
||||||
args = ["{}/run-dev.py".format(TOOLS_DIR)]
|
[os.path.join(TOOLS_DIR, "run-dev.py")],
|
||||||
STDOUT = subprocess.STDOUT
|
stdout=logfile, stderr=subprocess.STDOUT)
|
||||||
run_dev = subprocess.Popen(args, stdout=logfile, stderr=STDOUT)
|
|
||||||
|
|
||||||
try:
|
|
||||||
failure, log = start_server(logfile_name)
|
failure, log = start_server(logfile_name)
|
||||||
finally:
|
|
||||||
logfile.close()
|
|
||||||
|
|
||||||
run_dev.send_signal(signal.SIGINT)
|
run_dev.send_signal(signal.SIGINT)
|
||||||
run_dev.wait()
|
run_dev.wait()
|
||||||
|
|
||||||
if not failure and 'Traceback' in log:
|
if 'Traceback' in log:
|
||||||
failure = True
|
failure = True
|
||||||
|
|
||||||
if failure:
|
if failure:
|
||||||
|
|
Loading…
Reference in New Issue