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