Skip to content

Add "pre setup" log entry when enabling "--show-setup" #13169

Open
@ctheune

Description

@ctheune

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: fixturesanything involving fixtures directly or indirectlytopic: reportingrelated to terminal output and user-facing messages and errorstype: enhancementnew feature or API change, should be merged into features branch

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions