Tuesday, September 3, 2019

Making tests fast

I'm wondering how to make my tests fast while also having a lot of data defined in the models.  
This project is already using sqlite3 and the tests are single-threaded.

My ideas are:
  • Specify a different sqlite3 file and keepdb for different tests - presumably with @override_settings
  • Do something to copy this data into memory (see https://stackoverflow.com/questions/3850022/how-to-load-existing-db-file-to-memory-in-python-sqlite3) - I suspect Django already supports this, but I don't see where _clone_test_db is called.
I am loathe to use modelmommy and/or factoryboy because they are simply a bit harder to use.   I'd rather use dump data/load data with :memory database.

   

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/b22204f4-85db-4eb9-9a53-adca0dea269c%40googlegroups.com.

No comments:

Post a Comment