pytest-xdist
pytest-xdist copied to clipboard
added code to honor --log-cli-level (issue #402)
this fixes issue #402
Thanks for submitting a PR, your contribution is really appreciated!
Here's a quick checklist that should be present in PRs:
-
[ ] Make sure to include reasonable tests for your change if necessary
-
[ ] We use towncrier for changelog management, so please add a news file into the
changelogfolder following these guidelines:-
Name it
$issue_id.$typefor example588.bugfix; -
If you don't have an issue_id change it to the PR id after creating it
-
Ensure type is one of
removal,feature,bugfix,vendor,docortrivial -
Make sure to use full sentences with correct case and punctuation, for example:
Fix issue with non-ascii contents in doctest text files.
-
This change implements a logger relay handler that pumps the log message back to the master node, which then uses the master logger to display the log events.
To use it, simply set the --log-cli-level option as in normal pytest, and it will push the log level requested.
I believe that is what was asked for in #402
Hey @kurt-cb,
Thanks a lot for the contribution, creating a new event to send log events specifically is a good idea. 👍
Some extra things that would be important to have to get this merged:
- Tests that exercise the feature, preferably under different log settings (to at least avoid regressions).
- A Changelog entry.
Also left a few comments in the code, please take a look. 👍
Hi @kurt-cb , shall we pair program to appease @nicoddemus and get this merged? (I'd like to do it for you but don't know
if not True: # self.respect_handler_level:
class RemoteMessageHandler(logging.Handler):
"""
This handler sends events to a queue. Typically, it would be used together
with a multiprocessing Queue to centralise logging to file in one process
(in a multi-process application), so as to avoid file write contention
between processes.
This code is new in Python 3.2, but this class can be copy pasted into
how to resolve the comments on these two bits)
My direct contact if you wish to GMeet: wurmdario at gmail dot com
I gave up on this PR months ago. It was raised back in March. Anyway, the first issue, just need to get rid of the commented out code # self.respect_handler_le
The RemoteMessageHandler is based off of the Python QueueHandler that is part of python, here: https://docs.python.org/3/library/logging.handlers.html#queuehandler Source: https://github.com/python/cpython/blob/8f324b7ecd2df3036fab098c4c8ac185ac07b277/Lib/logging/handlers.py#L1412
@WurmD I addressed the items you were unsure about.
@WurmD as for the other issues, I don't have time right now to make those changes and test. If you would like to do it, go ahead. You can pull my branch and create a PR to cli_log. Once you push the first PR, I'll approve you as a contributor.
Here @kurt-cb , would you give me permissions to push to your branch?
@WurmD as for the other issues, I don't have time right now to make those changes and test. If you would like to do it, go ahead. You can pull my branch and create a PR to cli_log. Once you push the first PR, I'll approve you as a contributor.
Give me permissions to push to your branch please? @kurt-cb
@WurmD you can just pull his changes into your own fork, and open a new PR: his original commits will still be correctly attributed.
@WurmD, you should be able to make a PR on my repo. Once I accept the PR I can give you rights to approve.
@WurmD you need to fork kurt-cb/pytest-xdist (make sure you get all branches when you do this), then checkout cli_log, make your changes , then create a PR against kurt-cb/pytest-xdist. Once you do this, I will have the option to make you a contributor. I don't think I can do anything until you do this.
@WurmD I figured out how to make you a collaborator. You should be able to create wormd/cli_log branch and push your changes directly to there. then you can create a PR and I will review your changes and push them back here.
K, successfully PRed https://github.com/kurt-cb/pytest-xdist/pull/3