问题
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