Skip to content

Commit

Permalink
Refactor reset_checks django fixture
Browse files Browse the repository at this point in the history
- remove version check
- autouse so that checks are cleared after every test run
  • Loading branch information
grahamalama committed Aug 10, 2023
1 parent 658befa commit 1b6919e
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions tests/django/test_django.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import pytest
import redis
from django import VERSION as django_version
from django.core.checks.registry import registry
from django.core.exceptions import ImproperlyConfigured
from django.db import connection
Expand All @@ -20,14 +19,11 @@
from dockerflow.django.middleware import DockerflowMiddleware


@pytest.fixture
@pytest.fixture(autouse=True)
def reset_checks():
if django_version[0] < 2:
registry.registered_checks = []
registry.deployment_checks = []
else:
registry.registered_checks = set()
registry.deployment_checks = set()
yield
registry.registered_checks = set()
registry.deployment_checks = set()


@pytest.fixture
Expand Down

0 comments on commit 1b6919e

Please sign in to comment.