Reputation:
In My Project more than one test file and if i run
python manage.py tests
It takes huge time to complete the test and i don't want this way.
I want only run particular file of test like i have test
project/todo/tests/test_todo.py
project/accounts/tests/test_signup.py
project/todo/tests/test_archive.py
and lots more like above these:
Now i want to run only project/todo/tests/test_todo.py
How can i do it?
Upvotes: 0
Views: 314
Reputation: 556
You can run a particular test by using the following command.
python manage.py test -nk appname.test_folder.test_file
-n, --nomigrations Tells Django to NOT use migrations and create all
tables directly.
-k, --keepdb Preserves the test DB between runs.
Upvotes: 0
Reputation: 878
you can simply do python manage.py test project.todo.tests.test_todo
. Observe the difference here instead of giving it as a file, you can give it as a package. If you want to run a particular test case in a test suite, you can go ahead in the same way. python manage.py test project.todo.tests.test_todo.TestSuiteClass.TestCase
.
Upvotes: 2