Skip to content

Commit

Permalink
Make compatible with older pytest-django
Browse files Browse the repository at this point in the history
  • Loading branch information
walison17 authored and iurisilvio committed Feb 7, 2024
1 parent b2a001b commit db37be3
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions django_migrations_ci/pytest_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,16 @@ def pytest_configure(config):
return

try:
from pytest_django.plugin import blocking_manager_key
from pytest_django import plugin

blocking_manager = config.stash[blocking_manager_key]
db_unblock = blocking_manager.unblock
blocking_manager = config.stash[plugin.blocking_manager_key]
except AttributeError:
blocking_manager = plugin._blocking_manager
except ImportError:
# The pytest-django lib is not installed, do nothing and hope for the best.
db_unblock = nullcontext
else:
db_unblock = blocking_manager.unblock

verbosity = config.option.migrateci_verbose
if verbosity is None:
Expand Down

0 comments on commit db37be3

Please sign in to comment.