12👍
I have had success with unittest-xml-reporting:
TEST_RUNNER = 'xmlrunner.extra.djangotestrunner.XMLTestRunner'
https://github.com/xmlrunner/unittest-xml-reporting#django-support
The output directory can be configured with the TEST_OUTPUT_DIR
setting.
5👍
You may still use nose runner:
INSTALLED_APPS += ['django_nose']
TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
NOSE_ARGS = [
'--with-xunit',
'--xunit-file=nosetests.xml',
'--with-coverage',
'--cover-erase',
'--cover-xml',
'--cover-xml-file=nosecover.xml',
]
👤awka
- Inline in Django admin: has no ForeignKey
- Colorizing the output of Django tests
- Merge two fields in one in a Django Rest Framework Serializer
- Does changing a django models related_name attribute require a south migration?
2👍
So pytest
produces some very nice test output. I’ve unset TEST_RUNNER
in settings.py and changed my test script to:
python -m coverage run -m pytest --junitxml=./reports/junit.xml
python -m coverage report --include="app/*" --show-missing --fail-under=100
python -m coverage xml --include="app/*" -o ./reports/coverage.xml
This works, and captures ALL logging output (nose was a little buggy and let one or two logging statements slip through, very strange behavior).
The only thing is that I’m a django novice so I don’t know if there are any bad side-effects of not using manage.py test
for testing django. Any guidance is appreciated, thanks!
- Django fixture fails, stating "DatabaseError: value too long for type character varying(50)"
- Django Check and set permissions for a user group
Source:stackexchange.com