-
Notifications
You must be signed in to change notification settings - Fork 232
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
added code to honor --log-cli-level (issue #402) #883
base: master
Are you sure you want to change the base?
Conversation
for more information, see https://pre-commit.ci
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 |
This provides incremental output when test is running _without xdist_, just like the old runner did. With xdist the live output is not available, I believe because of pytest-dev/pytest-xdist#402 pytest-dev/pytest-xdist#883 might help with that, but I'm not going to hold my breath until it is available on distros we use.
This provides incremental output when test is running _without xdist_, just like the old runner did. With xdist the live output is not available, I believe because of pytest-dev/pytest-xdist#402 pytest-dev/pytest-xdist#883 might help with that, but I'm not going to hold my breath until it is available on distros we use.
This provides incremental output when test is running _without xdist_, just like the old runner did. With xdist the live output is not available, I believe because of pytest-dev/pytest-xdist#402 pytest-dev/pytest-xdist#883 might help with that, but I'm not going to hold my breath until it is available on distros we use.
This provides incremental output when test is running _without xdist_, just like the old runner did. With xdist the live output is not available, I believe because of pytest-dev/pytest-xdist#402 pytest-dev/pytest-xdist#883 might help with that, but I'm not going to hold my breath until it is available on distros we use.
This provides incremental output when test is running _without xdist_, just like the old runner did. With xdist the live output is not available, I believe because of pytest-dev/pytest-xdist#402 pytest-dev/pytest-xdist#883 might help with that, but I'm not going to hold my breath until it is available on distros we use. (cherry picked from commit d0619c7)
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:
Also left a few comments in the code, please take a look. 👍 |
record.args = None | ||
record.exc_info = None | ||
record.exc_text = None | ||
x = pickle.dumps(record) |
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.
Probably does not matter much, but we might force protocol version 4 here to ensure compatibility between different python interpreters.
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.
x = pickle.dumps(record, protocol=4)
or
x = pickle.dumps(record, protocol=pickle.DEFAULT_PROTOCOL)
?
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.
are log messages pickle safe?
im "pretty" sure there some hazard when dealing with custom objects
Initialise an instance, using the passed queue. | ||
""" | ||
logging.Handler.__init__(self) | ||
self.queue = queue |
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.
A bit confusing calling this queue
when it is actually a WorkerInteractor
instance, perhaps use worker_interactor
? Also worth updating the docs.
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
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 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 |
@WurmD |
@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? |
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. |
Co-authored-by: Bruno Oliveira <[email protected]>
K, successfully PRed kurt-cb#3 |
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
changelog
folder following these guidelines:Name it
$issue_id.$type
for 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
,doc
ortrivial
Make sure to use full sentences with correct case and punctuation, for example: