47đź‘Ť
Checked TEST_RUNNER
in settings.py
, it’s using a project-specific runner that calls out to Nose. Nose has the -s
option to stop it from capturing stdout
, but if I run:
./manage.py test -s
manage.py
captures it first and throws a “no such option” error. The help for manage.py
doesn’t mention this, but I found that if I run:
./manage.py test -- -s
it ignores the -s
and lets me capture it on the custom runner’s side, passing it to Nose without a problem.
42đź‘Ť
Yeah, this issue is caused by NoseTestSuiteRunner
. Adding -- -s
is tricky and not the best solution.
Try to add the following lines in the settings.py
:
NOSE_ARGS = ['--nocapture',
'--nologcapture',]
This solved my problems.
- [Django]-Sending post data from angularjs to django as JSON and not as raw content
- [Django]-Why is iterating through a large Django QuerySet consuming massive amounts of memory?
- [Django]-Suddenly when running tests I get "TypeError: 'NoneType' object is not iterable
28đź‘Ť
There are several levels of verbosity available which affects the amount of details we see:
You can try:
python manage.py test -v 2
Other levels available are:
-
-v 0
: Least amount of details -
-v 1
: Default -
-v 2
: More details e.g. print statements included.
- [Django]-Django: accessing session variables from within a template?
- [Django]-Django, ModelChoiceField() and initial value
- [Django]-Django – Get only date from datetime.strptime
6đź‘Ť
Using current versions of all the relevant packages (Django==1.11.2
, django-nose==1.4.5
and nose==1.3.7
) it is sufficient to add the --nocapture
flag when running your tests. Thus a simple
./manage.py test --nocapture
will suffice.
Granted of course that you have
TEST_RUNNER = "django_nose.NoseTestSuiteRunner"
in your settings.py
- [Django]-Django 1.7 – "No migrations to apply" when run migrate after makemigrations
- [Django]-Update only specific fields in a models.Model
- [Django]-Django template can't see CSS files
4đź‘Ť
You probably have some intermediate test runner, such as Nose, intercepting and storing stdout. Try either running the Django tests directly, or write to stderr instead.
- [Django]-Django development server, how to stop it when it run in background?
- [Django]-Django – Rotating File Handler stuck when file is equal to maxBytes
- [Django]-How do I create a slug in Django?