﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
23699	Migrate in unittest still loads initial data	tony-zhu	nobody	"The migrate command in Django 1.7 does not load the initial_data fixtures as claims in the release note.

However it still loads the initial_data in unittests, which crashes the unittest when using some libraries (Django-helpdesk in my case).

Here is what I found:

When initializing unit tests, the
create_test_db in db/backends/creation calls the migration command with test_flush=True

The migrate command checks the test_flush in line 135. Then calls the flush command which loads the initial data.

Adding ""load_initial_data=False"" to the migrate command fixed it in my local test environment

Here is the section changed: 
{{{
        # The test runner requires us to flush after a syncdb but before migrations,
        # so do that here.
        if options.get(""test_flush"", False):
            call_command(
                'flush',
                verbosity=max(self.verbosity - 1, 0),
                interactive=False,
                database=db,
                reset_sequences=False,
                inhibit_post_migrate=True,
                load_initial_data=False,
            )
}}}"	Bug	closed	Core (Management commands)	1.7	Normal	fixed		Andrew Godwin	Ready for checkin	1	0	0	0	0	0
