Add "pre setup" log entry when enabling "--show-setup" #13169
Labels
topic: fixtures
anything involving fixtures directly or indirectly
topic: reporting
related to terminal output and user-facing messages and errors
type: enhancement
new feature or API change, should be merged into features branch
What's the problem this feature will solve?
I've spent a long time trying to debug a fixture that was interacting with the environment and got stuck because the subprocess was trying to read from the PTY (It spawned an SSH that accidentally asked for host key verification) and it's been really hard trying to figure out what was going on (read: 4-6hs spent debugging this). Due to further environmental restrictions (being run in a NixOS vm test environment) I also had a hard time using strace not giving me relevant output.
I started with the process being stuck in collection (but this was an IO buffering issue) and then noticed that it's likely stuck while setting up some fixture. When using
--show-setup
I noticed that this only reports on the success of a fixture - I would have needed to get info which fixture is currently being set up.Describe the solution you'd like
I'd like to add more output (maybe introducing the
-vvv
level if this becomes too verbose for the-vv
level) that shows a "PRESETUP" stage (or something similar) before calling the setup of a fixture.This would have allowed me to more quickly pinpoint where my code is going wrong.
Alternative Solutions
I normally have pytest-timeout report those kinds of things to me, but for some reason it didn't trigger here. If it did trigger then it would have shown me the subprocess call which is stuck. We could ask the pytest-timeout authors whether they could take a look at that behaviour, too.
Additional context
I'd be happy to work on the PR if this is interesting.
The text was updated successfully, but these errors were encountered: