27👍
Since Django 1.9 it’s possible to run the tests in parallel by Django with its built-in unit-test features.
Django Docs: https://docs.djangoproject.com/en/3.0/ref/django-admin/#cmdoption-test-parallel
8👍
According to the Django 3.0 documentation there is a --parallel
option that you can use.
–parallel [N]
Runs tests in separate parallel processes. Since modern processors have multiple cores, this allows running tests significantly faster.
So you can use the following command to execute the tests in parallel.
python manage.py test --parallel
You can adjust the number of processes either by providing it as the option’s value, e.g. –parallel=4, or by setting the DJANGO_TEST_PROCESSES environment variable.
This can help considerably reduce your test execution time if you have a large Django project with quite a few test unit cases.
- [Django]-Django using get_user_model vs settings.AUTH_USER_MODEL
- [Django]-How do I keep my Django server running even after I close my ssh session?
- [Django]-How to compare dates in Django templates
3👍
You can use a parallel test runner for Django and Twisted described here: http://www.tomaz.me/2011/04/03/making-django-and-twisted-tests-faster.html (the source lives here https://github.com/Kami/parallel-django-and-twisted-test-runner – link at the end of the post). You can use it as described in Django docs on testing.
There is also a nose parallel test runner.
- [Django]-How to make a Django custom management command argument not required?
- [Django]-How to insert a checkbox in a django form
- [Django]-Using AuthenticationForm in Django
-7👍
You can easily split the testing for apps on parrallalel on linux by:
$ python manage.py test cms & \
python manage.py test blog & \
python manage.py test store & \
python manage.py test registration
$
Could be helpfull for big projects with a lot of apps, the best would be a bash scripts that runs tests every four apps.
- [Django]-How can I run a celery periodic task from the shell manually?
- [Django]-Django required field in model form
- [Django]-Python Django: You're using the staticfiles app without having set the STATIC_ROOT setting