Do not hang forever if test server fails to start
Ā
AK
9mo ago+31+31+01234567890123456789-4-4-0123456789
Summary
I was wondering why the test suite just hung forever, and finally with pytest tests/ -vvvx --log-cli-level=DEBUG -s I found that:
[Errno 48] error while attempting to bind on address ('127.0.0.1', 8000): [errno 48] address already in use
ā yep, I was working on something else on port 8000 ā and so, server.running never becomes True, and tests just hang.
This PR:
- Makes sure errors from
server.run()(in the secondary thread) are caught and propagated immediately to the controlling loop - Adds timeouts, so even if something even more unexpected happens, the suite will error out instead of hanging forever.
Checklist
- I understand that this PR may be closed in case there was no previous discussion. (This doesn't apply to typos!)
- I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
- No separate tests for testing the test fixture š
- I've updated the documentation accordingly.
- No user-facing or developer documentation changes needed. (Noting that port 8000 must not be in use is a separate thing to maybe document, I think...)