Skip to content
This repository has been archived by the owner on Apr 8, 2019. It is now read-only.

Commit

Permalink
more info for travis
Browse files Browse the repository at this point in the history
  • Loading branch information
tarekziade committed Feb 28, 2017
1 parent 0598aa5 commit da8625b
Showing 1 changed file with 23 additions and 9 deletions.
32 changes: 23 additions & 9 deletions serviceweb/tests/support.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,29 @@ def _run():
from io import StringIO
import warnings

# might want to drop it in a file
sys.stderr = sys.stdout = StringIO()
socketserver.TCPServer.allow_reuse_address = True

test_dir = os.path.dirname(_BOOK)
os.chdir(test_dir)

with warnings.catch_warnings():
warnings.simplefilter("ignore")
app = app(_BOOK)
try:
app.run(port=port, debug=False)
except KeyboardInterrupt:
pass
try:
with warnings.catch_warnings():
warnings.simplefilter("ignore")
app = app(_BOOK)
try:
app.run(port=port, debug=False)
except KeyboardInterrupt:
pass
finally:
sys.stderr.seek(0)
sys.stdout.seek(0)

with open("coserver.stdout", 'w') as f:
f.write(sys.stdout.read())

with open("coserver.stderr", 'w') as f:
f.write(sys.stderr.read())

p = multiprocessing.Process(target=_run)
p.start()
Expand All @@ -66,7 +75,12 @@ def _run():

if not connected:
if not p.is_alive():
print("Looks like the process never started")
print("Looks like the process is born-dead")
with open("coserver.stdout") as f:
print(f.read())

with open("coserver.stderr") as f:
print(f.read())
else:
os.kill(p.pid, signal.SIGTERM)
p.join(timeout=1.)
Expand Down

0 comments on commit da8625b

Please sign in to comment.