mirror of
https://github.com/vale981/jobmanager
synced 2025-03-05 18:01:38 -05:00
UnboundLocalError: local variable 'p_server' referenced before assignment
This commit is contained in:
parent
b0d00e5695
commit
7142c96081
1 changed files with 32 additions and 33 deletions
|
@ -775,12 +775,11 @@ def test_exception():
|
|||
PORT += 2 # plus two because we also check for wrong port
|
||||
port = PORT
|
||||
authkey = 'q'
|
||||
try:
|
||||
with open("ap_server.out", 'w') as outfile:
|
||||
p_server = autoproxy_server(p_version_server, port, authkey, outfile)
|
||||
print("autoproxy server running with PID {}".format(p_server.pid))
|
||||
time.sleep(1)
|
||||
|
||||
with open("ap_server.out", 'w') as outfile:
|
||||
p_server = autoproxy_server(p_version_server, port, authkey, outfile)
|
||||
print("autoproxy server running with PID {}".format(p_server.pid))
|
||||
time.sleep(1)
|
||||
try:
|
||||
print("running tests with python {} ...".format(sys.version_info[0]))
|
||||
print()
|
||||
|
||||
|
@ -851,34 +850,34 @@ def test_exception():
|
|||
|
||||
assert s1 == s2
|
||||
|
||||
finally:
|
||||
print()
|
||||
print("tests done! terminate server ...".format())
|
||||
|
||||
p_server.send_signal(signal.SIGTERM)
|
||||
|
||||
t = time.time()
|
||||
timeout = 10
|
||||
r = None
|
||||
while r is None:
|
||||
r = p_server.poll()
|
||||
time.sleep(1)
|
||||
print("will kill server in {:.1f}s".format(timeout - (time.time() - t)))
|
||||
if (time.time() - t) > timeout:
|
||||
print("timeout exceeded, kill p_server")
|
||||
print("the managers subprocess will still be running, and needs to be killed by hand")
|
||||
p_server.send_signal(signal.SIGKILL)
|
||||
break
|
||||
|
||||
print("server terminated with exitcode {}".format(r))
|
||||
|
||||
with open("ap_server.out", 'r') as outfile:
|
||||
print("+"*40)
|
||||
print("this is the server output:")
|
||||
for l in outfile:
|
||||
print(" {}".format(l[:-1]))
|
||||
print("+"*40)
|
||||
finally:
|
||||
print()
|
||||
print("tests done! terminate server ...".format())
|
||||
|
||||
p_server.send_signal(signal.SIGTERM)
|
||||
|
||||
t = time.time()
|
||||
timeout = 10
|
||||
r = None
|
||||
while r is None:
|
||||
r = p_server.poll()
|
||||
time.sleep(1)
|
||||
print("will kill server in {:.1f}s".format(timeout - (time.time() - t)))
|
||||
if (time.time() - t) > timeout:
|
||||
print("timeout exceeded, kill p_server")
|
||||
print("the managers subprocess will still be running, and needs to be killed by hand")
|
||||
p_server.send_signal(signal.SIGKILL)
|
||||
break
|
||||
|
||||
print("server terminated with exitcode {}".format(r))
|
||||
|
||||
with open("ap_server.out", 'r') as outfile:
|
||||
print("+"*40)
|
||||
print("this is the server output:")
|
||||
for l in outfile:
|
||||
print(" {}".format(l[:-1]))
|
||||
print("+"*40)
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
Loading…
Add table
Reference in a new issue