pytest icon indicating copy to clipboard operation
pytest copied to clipboard

Add a new hook to inform user of current state on signal

Open yurivict opened this issue 1 year ago • 4 comments

What's the problem this feature will solve?

When some tests run for a very long time it is important to be able to know what are these tests. Currently it is difficult to find out.

Describe the solution you'd like

Pressing Ctrl-T should show the list of currently running tasks.

On FreeBSD we have a similar situation: the program that builds packages normally prints what packages were just finished or started, but when Ctrl-T is pressed it prints the list of currently running builds like this:

image

PyTest should do the same and on Ctrl-T should print the list of all currently running tests with their times, statuses, etc.

yurivict avatar Jun 02 '24 08:06 yurivict

PTest itself is not parallel/concurrent

However it's possibly a nice feature to have a hangup signal handler that triggers a hook which lets plugins inform the user of the current state

Pytest itself could return the current test In non-verbose mode

xdist could return the active test per gateway

RonnyPfannschmidt avatar Jun 02 '24 09:06 RonnyPfannschmidt

As @RonnyPfannschmidt said, that feature would not make sense for pytest because it does not run tests in parallel (pytest-xdist and other plugins do, however).

I'm closing this for now, but another issue can be opened with a proposal for a new hook as outlined by @RonnyPfannschmidt. 👍

nicoddemus avatar Jun 02 '24 12:06 nicoddemus

[...] but another issue can be opened with a proposal for a new hook [...]

I suggested a feature that would be potentially very useful.

How it is implemented and what hooks should be involved is an implementation detail. I am not a PyTest developer and don't know what is the best way to implement this feature. Developers should decide this, not me.

I don't know why this feature proposal was closed because this is a valid proposal for a needed, useful feature. I don't know what hooks should be involved.

yurivict avatar Jun 02 '24 16:06 yurivict

I didn't mean for you to open a new issue, sorry @yurivict.

I just think that we probably should work on a proposal for the hook in a separate issue, otherwise this tends to get "lost" in the midst of unrelated discussion.

But in retrospect I should not have closed this, as you mention, indeed this describes the feature, which is independent on how it will end up being actually implemented.

nicoddemus avatar Jun 02 '24 16:06 nicoddemus