From cfb8a0619f5fc0e54c414c420a66a09025bfedf8 Mon Sep 17 00:00:00 2001 From: Benjamin Dauvergne Date: Sun, 11 Apr 2021 16:24:38 +0200 Subject: [PATCH] tests: detect use of --nomigrations through pytestconfig Module pytest_django.migrations was removed in pytest_django 4.2.0. --- tests/conftest.py | 9 --------- tests/test_concurrency.py | 4 +++- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 114ce271f..22d3c5f34 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -27,7 +27,6 @@ from django.core.cache import cache from django.core.management import call_command from django.db import connection from django.db.migrations.executor import MigrationExecutor -from pytest_django.migrations import DisableMigrations from authentic2 import hooks as a2_hooks from authentic2.a2_rbac.utils import get_default_ou @@ -283,14 +282,6 @@ def concurrency(settings): return 100 -@pytest.fixture -def migrations(): - from django.conf import settings - - if isinstance(settings.MIGRATION_MODULES, DisableMigrations): - pytest.skip('this test requires native migrations') - - @pytest.fixture def oidc_client(db, ou1): client = OIDCClient.objects.create( diff --git a/tests/test_concurrency.py b/tests/test_concurrency.py index 959583473..3f3ae270e 100644 --- a/tests/test_concurrency.py +++ b/tests/test_concurrency.py @@ -23,7 +23,9 @@ from authentic2.models import Attribute, AttributeValue @pytest.mark.slow -def test_attribute_value_uniqueness(migrations, transactional_db, simple_user, concurrency): +def test_attribute_value_uniqueness(transactional_db, simple_user, concurrency, pytestconfig): + if pytestconfig.getoption('nomigrations'): + pytest.skip('running migrations is required for this test') # disable default attributes Attribute.objects.update(disabled=True)