Make hanging pytest tests more debuggable
Background
One of the more frequent headaches we've been running into are test cases that fail to fail because a subprocess ends up raising an exception in a location where it isn't safe to do so yet - usually those cases are impossible to actually reach in production, but during development they aren't uncommon.
This tends to result in a pytest run that just continues forever, and requires some non-obvious hackery to debug.
Task description
One way to resolve this would be to add timeouts of some sort to our test cases, which if they expire force terminate buildstream, printing a nice stack trace. This would make the actual error visible, and save a lot of time spent fighting the test suite.
pytest-timeout might be just what we need.
Obviously finding a reasonable timeout time isn't simple, and I would dislike actually setting timeouts for individual tests, but having a default argument wth a reasonably high timeout value could make running ./setup.py test
much more useful.
This is just one suggestion, of course, feel free to discuss :)
Acceptance Criteria
BuildStream should detect and print stack traces on "hangs" - i.e., test cases that fail to continue because a subprocess is being waited for indefinitely.