2
0
mirror of https://github.com/frappe/frappe_docker.git synced 2024-11-10 07:11:00 +00:00
frappe_docker/test.py
vishalseshagiri 5f6e0fc104 amended commit
Former-commit-id: fa2b54c67c
2017-10-02 09:48:51 +05:30

32 lines
827 B
Python

import subprocess, requests, datetime, _thread, time, os, signal
start_time = datetime.datetime.now().time()
r = None
e = None
bench_start = 'docker exec -i frappe bash -c "bench start"'
process = subprocess.Popen(bench_start, shell=True)
def print_out(val,delay):
while 1:
time.sleep(delay)
if val == 1:
result,error = process.communicate()
print(result)
elif val == 2:
try:
r = requests.get("http://site1.local:8000")
print(r)
except requests.exceptions.ConnectionError as e:
print(e)
_thread.start_new_thread(print_out, (1, 1))
#result, error = process.communicate()
_thread.start_new_thread(print_out, (2, 1))
time.sleep(45)
os.killpg(os.getpgid(process.pid), signal.SIGTERM) # Kill bench start
print(r.content)
assert '<title> Login </title>' in r.content, "Login page failed to load"