vendredi 5 mai 2017

How do I run Django tests on a copy of my production database?

I've written a series of tests for my Django app, and would like to run them on a copy of my production database.

As far as I can tell, the best way to do this is using fixture loading like so:

  • Run manage.py dumpdata -o app.dump
  • Move the resulting app.dump file to a fixtures directory in the [app name] folder
  • Specify a 'fixtures' class attribute on my django.test.TestCase subclass

However, this approach is cumbersome. I have multiple apps, and running manage.py dumpdata for each of them and manually moving around fixtures files every time I want to test my app is a pain.

Is there an easier way to automatically generate a copy of my entire production database and test my Django apps against it?

Aucun commentaire:

Enregistrer un commentaire