Skip to content

Test and update fixture loading, in MySQL and other engines #314

@jwhitlock

Description

@jwhitlock

_foreign_key_ignoring_handle in django_nose.runner has this comment:

def _foreign_key_ignoring_handle(self, *fixture_labels, **options):
"""Wrap the the stock loaddata to ignore foreign key checks.
This allows loading circular references from fixtures, and is
monkeypatched into place in setup_databases().
"""

This was brought over in #50, a large refactor to merge in the test-utils project.

This code presented problems when fixtures were loaded with Django 2.0, which were tracked down to assumptions about the commit argument, removed in Django 1.5 (see #307 (comment)). The code was fixed in #308, and @dlareau suggested the code should be revisited (see #307 (comment)).

It is possible that modern Django has other methods for loading fixtures while avoiding circular imports, and _foreign_key_ignoring_handle should be retired. A good first step would be to add a django-nose test that exercises loading fixtures, ideally with a circular reference.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions