I would like to start ipdb every time a test fails. I tried
$ ipython manage.py test myapp --pdb
but doesn't works.
Open /catalog/tests/test_models.py.TestCase , as shown: from django. test import TestCase # Create your tests here. Often you will add a test class for each model/view/form you want to test, with individual methods for testing specific functionality.
The request factory The RequestFactory shares the same API as the test client. However, instead of behaving like a browser, the RequestFactory provides a way to generate a request instance that can be used as the first argument to any view.
The preferred way to write tests in Django is using the unittest module built-in to the Python standard library. This is covered in detail in the Writing and running tests document. You can also use any other Python test framework; Django provides an API and tools for that kind of integration.
You can use the django-pdb app. Only install in your settings project
If you pip install ipdbplugin
and pip install django-nose
, then add django_nose
to your INSTALLED_APPS
and set TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
, you can then call:
./manage.py test --ipdb
or
./manage.py test --ipdb-failures
See https://github.com/flavioamieiro/nose-ipdb and https://github.com/django-nose/django-nose for further details.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With