How to improve Testcase speed in Django?

Asked

Viewed 51 times

0

I’m running a test on Django with only two querys and the timer is taking 1 min and 10 seconds to complete the test. Is there any settings you can adjust to speed up the tests?

I’m currently using in the project database.

1 answer

1


I was able to improve performance by changing the bank to sqlite3 and directing the test to a specific app:

py Settings. (at the end of the archive):

import sys
if 'test' in sys.argv:
    DATABASES['default'] = {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': 'test_db'
    }

terminal:

$ ./manage.py test animals.tests

While running the test time dropped to 5 seconds.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.