New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use setproctitle if available to show state #696
Conversation
setproctitle() changes the process name, particularly in top/ps output on posix-y systems. This is very useful to get some transparency on what's going on, especially if a test starts taking a very long time or straight up hangs. This is strictly a "bonus goodie", if setproctitle is not available, it's not used, and any errors are ignored silently. Signed-off-by: David Lamparter <equinox@diac24.net>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @eqvinox,
Thanks a lot for the contribution, we appreciate it!
I think we still need a few things before we can merge it:
-
We should configure an
extras
so users can install withpip install pytest-xdist[setproctitle]
, in case we want to pin compatible versions in the future. Probably just change:Line 21 in 5e0b40c
extras_require={"testing": ["filelock"], "psutil": ["psutil>=3.0"]}, To:
extras_require={"testing": ["filelock"], "psutil": ["psutil>=3.0"], "setproctitle": ["proctitle"]},
-
Add docs to the README, including the above extra and a quick paragraph about what it does (like you did in the PR description).
-
In
tox.ini
, we need to test with this package, which can be done in its own environment (similar to[testenv:py38-psutil]
). Also configure CI to run this test environment on Linux.
A test would be good, but I can't think of a way to test this without going through complicated hoops, so I think we can skip that.
While the change is pretty trivial, all this is important to ensure we don't break things by accident later.
Finally, I did take a quick look, but can you double check if the same can be done using psutil
(which we already have the option to use)?
@nicoddemus hope to have addressed all your comments. I couldn't really test the tox item since Debian only provides Python 3.7 and 3.9, installing 3.8 would've been a major hassle, sorry about that 😞.
(Also, as a Linux low-level developer, I can tell you |
It might be possible with the combination of |
Figured as much, thanks! |
Thanks again @eqvinox! I will prepare a release soon (possibly today) |
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
Sorry for the delay, |
setproctitle() changes the process name, particularly in top/ps output
on posix-y systems. This is very useful to get some transparency on
what's going on, especially if a test starts taking a very long time or
straight up hangs.
This is strictly a "bonus goodie", if setproctitle is not available,
it's not used, and any errors are ignored silently.