Skip to content

Commit

Permalink
Restore UnsealedAttributeAccess elevation to error in tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
charettes committed Sep 4, 2024
1 parent b2f199a commit 4cfa862
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/test_query.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pickle
import warnings

from django.apps import apps
from django.contrib.contenttypes.models import ContentType
Expand Down Expand Up @@ -49,6 +50,10 @@ def setUpTestData(cls):
tests_models = tuple(apps.get_app_config("tests").get_models())
ContentType.objects.get_for_models(*tests_models, for_concrete_models=True)

def setUp(self):
warnings.filterwarnings("error", category=UnsealedAttributeAccess)
self.addCleanup(warnings.resetwarnings)

def test_state_sealed_assigned(self):
instance = SeaLion.objects.seal().get()
self.assertTrue(instance._state.sealed)
Expand Down

0 comments on commit 4cfa862

Please sign in to comment.