pelme/pytest_django — pull request #166 by blueyed (2014-09-03 04:36:19+00:00)
Title: Skip monkey-patching for South with Django 1.7

This fixes the following error when South tries to access
`management._commands`, which has been dropped in Django 1.7:

…/pytest_django/pytest_django/fixtures.py:41: in _django_db_setup
_handle_south()
…/pytest_django/pytest_django/fixtures.py:128: in _handle_south
patch_for_test_db_setup()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

def patch_for_test_db_setup():
# Load the commands cache
management.get_commands()
# Repoint to the correct version of syncdb
if hasattr(settings, "SOUTH_TESTS_MIGRATE") and not settings.SOUTH_TESTS_MIGRATE:
# point at the core syncdb command when creating tests
# tests should always be up to date with the most recent model structure
management._commands['syncdb'] = 'django.core'
else:
> management._commands['syncdb'] = MigrateAndSyncCommand()
E AttributeError: 'module' object has no attribute '_commands'

…/site-packages/south/management/commands/__init__.py:34: AttributeError

I wonder if we should output some warning here, because South is not meant to be used with Django 1.7?!

The patch/diff looks huge, but is mostly whitespace / indentation.