-
Notifications
You must be signed in to change notification settings - Fork 352
Description
Our test suite uses a custom TestRunner which has a run_suite method like so:
def run_suite(self, suite, **kwargs):
call_command('loaddata', 'foo')
call_command('loaddata', 'bar')
return super(CustomTestRunner, self).run_suite(suite, **kwargs)
The fixtures it loads are indeed so common it makes sense just to load them for every test case. For example we host multiple Sites off of our app and one of the fixtures loads a subset of those Site objects. Foreign keys to Site exist in almost all our apps so it makes sense to just load a few before the whole suite.
Although in theory I should be able to rename the fixtures to initial_data.json and have them load, that is for whatever strange reason not working. That is when I found there is no way to duct-tape over it in py.test, because the only time db access is allowed is at the function level.
Are there any plans to include a session-level fixture for db access?