Corrected database setup and teardown of bare pytest classes.

Flushes the database on teardown, and deals with a few other necessities, when a test-case is just a bare pytest class (i.e. not a subclass of Django's TestCase).