vendredi 20 janvier 2017

PyTest-Django Failing on missing django_migration table

I'm trying to add pytest-django and pytest 3 to my current pytest2/Django1.7 environment.

Everything seems to visually look good and the tests seem to pass until the end when I get the following error messages:

request = <SubRequest '_django_db_marker' for <Function 'test_filter_recurring_outside_sync_window'>>

    @pytest.fixture(autouse=True)
    def _django_db_marker(request):
        """Implement the django_db marker, internal to pytest-django.

        This will dynamically request the ``db`` or ``transactional_db``
        fixtures as required by the django_db marker.
        """
        marker = request.keywords.get('django_db', None)
        if marker:
            validate_django_db(marker)
            if marker.transaction:
                getfixturevalue(request, 'transactional_db')
            else:
                getfixturevalue(request, 'db')

ve/lib/python2.7/site-packages/pytest_django/plugin.py:376:


self = <django.db.backends.sqlite3.base.SQLiteCursorWrapper object at 0x11976a478>
query = 'SELECT "django_migrations"."app", "django_migrations"."name" FROM "django_migrations"', params = ()

    def execute(self, query, params=None):
        if params is None:
            return Database.Cursor.execute(self, query)
        query = self.convert_query(query)
>       return Database.Cursor.execute(self, query, params)
E       OperationalError: no such table: django_migrations

ve/lib/python2.7/site-packages/django/db/backends/sqlite3/base.py:485: OperationalError

I tried creating the table with ensure_schema in the conftest.py. I've tried every option of --nomigrations and --create-db to pytest.

I'm guessing it's a weird configuration problem I have with a legacy system, but I'm not sure where to start looking. Anyone have suggestions?

Aucun commentaire:

Enregistrer un commentaire