Merge pull request #3855 from jsaalfeld/fix_migrate
fixing pytest version and continue if db not available
This commit is contained in:
commit
e0c38cba01
@ -6,6 +6,7 @@ from django.apps import AppConfig
|
||||
from django.conf import settings
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
from django.db.models.signals import post_migrate
|
||||
from django.db.utils import OperationalError
|
||||
|
||||
from ..utils.projector import register_projector_elements
|
||||
|
||||
@ -43,8 +44,8 @@ class CoreAppConfig(AppConfig):
|
||||
# Set constants
|
||||
try:
|
||||
set_constants(get_constants_from_apps())
|
||||
except ImproperlyConfigured:
|
||||
# Database is not loaded. This happens in tests.
|
||||
except (ImproperlyConfigured, OperationalError):
|
||||
# Database is not loaded. This happens in tests and migrations.
|
||||
pass
|
||||
|
||||
# Define config variables and projector elements.
|
||||
|
@ -4,7 +4,7 @@ coverage
|
||||
git+https://gitlab.com/pycqa/flake8.git
|
||||
isort
|
||||
mypy
|
||||
pytest>=3.7.2
|
||||
pytest>=3.6,<3.7
|
||||
pytest-django
|
||||
pytest-asyncio
|
||||
pytest-cov
|
||||
|
@ -9,7 +9,7 @@ def pytest_collection_modifyitems(items):
|
||||
Helper until https://github.com/pytest-dev/pytest-django/issues/214 is fixed.
|
||||
"""
|
||||
def get_marker_transaction(test):
|
||||
marker = test.get_marker('django_db')
|
||||
marker = test.get_closest_marker('django_db')
|
||||
if marker:
|
||||
validate_django_db(marker)
|
||||
return marker.kwargs['transaction']
|
||||
|
Loading…
Reference in New Issue
Block a user