#32552: Change DiscoverRunner to use a logger instead of print
-------------------------------------+-------------------------------------
Reporter: Chris | Owner: nobody
Jerdonek |
Type: New | Status: new
feature |
Component: Testing | Version: 4.0
framework | Keywords:
Severity: Normal |
DiscoverRunner,print,logging,stdout,stderr
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
Currently, the `DiscoverRunner` class (used when running tests) "logs" by
printing directly to stdout. Here is one example:
https://github.com/django/django/blob/7bdd09d016f418719f2d0297f58bd81c5349101d/django/test/runner.py#L592-L596
It would be much better if `DiscoverRunner` could instead use a Python
logger. The "verbosity" of each `print()` statement could be converted to
a log message at an appropriate level.
Related to this, passing a `--verbosity {0,1,2,3}` (e.g. when using
[https://github.com/django/django/blob/7bdd09d016f418719f2d0297f58bd81c5349101d/tests/runtests.py#L433-L436
runtests.py]) could configure a logger at the appropriate level.
This ticket is related to (but different from) ticket #21429, which is
about `BaseCommand`. While `DiscoverRunner` can be triggered by the `test`
command, it can also be run separately from a management command, e.g. via
`runtests`.
--
Ticket URL: <https://code.djangoproject.com/ticket/32552>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/052.62a3dae7a4d80309006180072b3134b7%40djangoproject.com.