Speed up the test suite on Django 1.7+.
Review Request #9552 — Created Jan. 28, 2018 and submitted — Latest diff uploaded
Django 1.7+ runs our test suite pretty slowly, due to all the migration
work it performs for all the models on every test. We can speed this up
by removing some unneeded settings. We no longer use any middleware
(which shouldn't have an effect, but isn't necessary), and, more
importantly, we no longer include a bunch of Django apps that aren't
really needed.The app removal is the big thing. The Sites, Auth, and Admin apps are no
longer included, meaning a lot fewer models to write to the database.
This makes a very noticeable impact on the run time. There's only one
test that needed to be changed for this, to check for a different
(mandatory) model in the database signature.To make this work, though, we needed to make the Session and Auth apps
optional. The builtin evolutions list assumed those would always be
included, and they normally would be, but it's not necessary to always
have them there. We now check forRuntimeError
s, which those will
raise if they're not listed inINSTALLED_APPS
, and only add to the
builtin evolution list if we can import successfully.
Unit tests pass on Django 1.6 through 1.10.