Django nose to run only project tests

岁酱吖の 提交于 2020-02-04 01:16:12

问题


I added nose, django-nose, nose-exclude, coverage to my buildout.cfg and ran buildout. Furthermore I added the TEST_RUNNER and the NOSE_ARGS to my settings.py. In the last step I created a exclude_dirs.txt and included it into the NOSE_ARGS. That worked so far.

Finally I ran bin/django testto run the tests of my project. I found out that every app inside INSTALLED_APP is run and that even parts of the django core models are run. How can I limit this to my project only without exernal packages?


回答1:


In your settings.py file you can do the following:

TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
NOSE_ARGS = [
'--cover-package=your_app_name',
'--with-coverage', 
]

Assuming you have added all the reqd. apps to settings.py file in INSTALLED_APPS. This will fix the issue!



来源:https://stackoverflow.com/questions/12479985/django-nose-to-run-only-project-tests

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!