Skip to content

Commit

Permalink
Fixed test about warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
lorinkoz committed Jun 26, 2023
1 parent 67faa99 commit d0d777d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions dpgs_sandbox/tests/test_schema.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import warnings

from django.test import SimpleTestCase


class TestDeprecatedImports(SimpleTestCase):
def test_schema_descriptor_warning(self):
import warnings

warnings.simplefilter("error")

with self.assertRaises(DeprecationWarning) as ctx:
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter("always")
from django_pgschemas.schema import SchemaDescriptor # noqa

self.assertEqual(str(ctx.exception), "'SchemaDescriptor' is deprecated, use 'Schema' instead")
self.assertEqual(len(w), 1)
self.assertEqual(str(w[0].message), "'SchemaDescriptor' is deprecated, use 'Schema' instead")

def test_schema_descriptor_accessible(self):
from django_pgschemas.schema import SchemaDescriptor
Expand Down

0 comments on commit d0d777d

Please sign in to comment.