#27430 closed New feature (fixed)
`manage.py test` does not support unittest `-b` buffer option
| Reported by: | Paul Tiplady | Owned by: | Baptiste Mispelon |
|---|---|---|---|
| Component: | Testing framework | Version: | dev |
| Severity: | Normal | Keywords: | |
| Cc: | Jackie Leng, Hugo Osvaldo Barrera | Triage Stage: | Accepted |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | yes | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description (last modified by )
Unittest supports buffering of test output with the -b flag, such that passing tests do not spam stdout/stderr with output. This is the default behaviour for nosetests, as well.
I can't see any way to enable this behaviour in manage.py test. Has adding support for this flag been considered?
Currently my workaround is to use nosetests (with django-nose), but that test runner appears to be bugged WRT the new --parallel flag, so it's not a perfect solution.
Change History (11)
comment:1 by , 9 years ago
| Description: | modified (diff) |
|---|
comment:2 by , 9 years ago
| Description: | modified (diff) |
|---|
comment:3 by , 9 years ago
| Cc: | added |
|---|---|
| Triage Stage: | Unreviewed → Accepted |
| Type: | Uncategorized → New feature |
comment:4 by , 9 years ago
| Owner: | changed from to |
|---|---|
| Status: | new → assigned |
comment:5 by , 9 years ago
There is a humble, yet incomplete attempt at this in https://github.com/atombrella/django/commit/4ada8bb0000106982f2cd5fb11e5ccdc278aa1c8 in case someone wants to complete it.
comment:6 by , 8 years ago
| Cc: | added |
|---|
comment:7 by , 6 years ago
| Has patch: | set |
|---|---|
| Owner: | changed from to |
| Version: | 1.10 → master |
As noted in the PR, I couldn't figure out how to make the option work when running the tests in parallel.
Python's unittest implements the --buffer feature on its 'TestResult` class but Django reimplements that class from scratch in the case of parallel tests.
It might be possible to re-add all the stdout/stderr manupulation that Python does but even then I'm not sure how modifying sys.stdout would interact with multiprocessing (is it safe to do so?).
I didn't add any tests because I couldn't find examples in the existing test suite of how to construct a test case for this behavior.
(I used #30676 as a base to build this PR and it didn't come with tests either, but maybe that one was harder to test so it's more justified than for this ticket)
comment:8 by , 6 years ago
| Needs tests: | set |
|---|
Verified on master, there is no -b option or any option that seems to work the same way.