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
Refs #32552 -- Added DiscoverRunner.log() to allow customization. #14150
Conversation
The tests for DiscoverRunner django/tests/test_runner/test_discover_runner.py Lines 336 to 337 in 3704481
and django/tests/test_runner/test_discover_runner.py Lines 252 to 262 in 3704481
only check for verbosity >= 2. I believe we should add tests for verbosity < 2 as well. Thoughts? |
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.
Thanks. One comment..
Also, the title of the PR should be something like "Added a DiscoverRunner.log() method" since you're not actually changing |
I would add a single new test called |
4ad06b3
to
330de72
Compare
Just made few changes. Let me know if this seems better. Working on the tests! |
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.
Just made few changes. Let me know if this seems better.
It looks like you didn't finish addressing my previous comments: #14150 (comment)
I've repeated them inline with some additional explanation and added a couple other comments.
330de72
to
8b221a2
Compare
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 @abbasidaniyal — Thanks for updating this.
- Please look at the existing test failures.
- Also see Chris' comment about adding a new
test_log()
, with the appropriate matrix of combinations. (SeesubTest
Python docs and examples in the test suite for usage.)
Once those are in place and addition to the DiscoverRunner docs and a release note in releases/4.0.txt
would be appropriate.
Just made these changes. Not sure if the docs and the release notes are under the appropriate heading, let me know if I need to make amends. |
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.
Some comments.
737caf9
to
cf9ecc1
Compare
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.
Okay, last round of comments (I think?). They're more minor than before. Thanks again for keeping at it, @abbasidaniyal.
docs/topics/testing/advanced.txt
Outdated
.. method:: DiscoverRunner.log(msg, level=None) | ||
|
||
Logs a message at the given `logging level <https://docs.python.org/3/library/logging.html#levels>`_ | ||
respecting the current ``verbosity``. For example, INFO will be logged if the verbosity is at least 1, |
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.
Backticks are needed around INFO
, 1
, DEBUG
, and 2
.
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.
Please also add a .. versionadded 4.0
directive. With a shirt note saying this method was added.
(3, logging.INFO, True), | ||
(3, logging.WARNING, True) | ||
] | ||
|
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.
You can remove the empty line above and the two empty lines below.
cf9ecc1
to
a190cc7
Compare
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.
Your prompt for a review made me look at this again. 😄
A few small questions/comments, I suspect most can be ignored.
Thanks Carlton Gibson, Chris Jerdonek, and David Smith for reviews.
Thanks y'all 🚀 I rebased and pushed small edits. |
ticket-32552
Add a method
log(self, message, level)
to DiscoverRunner class which prints the message by comparing the level with self.verbosity.Replace the use of print with self.log