2017-08-02 14:40:20 +00:00
|
|
|
import subprocess, requests, datetime, _thread, time, os, signal
|
|
|
|
start_time = datetime.datetime.now().time()
|
|
|
|
bench_start = 'docker exec -i frappe bash -c "bench start"'
|
2017-08-03 09:35:55 +00:00
|
|
|
process = subprocess.Popen(bench_start, stdout=subprocess.PIPE , shell=True)
|
|
|
|
|
2017-08-02 14:40:20 +00:00
|
|
|
|
|
|
|
def print_out(val,delay):
|
|
|
|
while 1:
|
|
|
|
time.sleep(delay)
|
|
|
|
if val == 1:
|
|
|
|
result,error = process.communicate()
|
|
|
|
print(result)
|
|
|
|
elif val == 2:
|
|
|
|
try:
|
2017-08-03 10:28:30 +00:00
|
|
|
global r
|
2017-08-02 14:40:20 +00:00
|
|
|
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))
|
2017-08-02 11:16:50 +00:00
|
|
|
|
2017-08-03 10:28:30 +00:00
|
|
|
time.sleep(30)
|
2017-08-02 11:16:50 +00:00
|
|
|
|
2017-08-03 09:35:55 +00:00
|
|
|
process.kill()
|
2017-08-02 14:40:20 +00:00
|
|
|
|
2017-08-03 09:35:55 +00:00
|
|
|
assert '<title> Login </title>' in str(r.content)
|