From 09ffc5c1212d4ced58b708cbbf3dfbfb77b782ca Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Thu, 1 Dec 2022 20:23:43 +0100 Subject: Fixed #33308 -- Added support for psycopg version 3. Thanks Simon Charette, Tim Graham, and Adam Johnson for reviews. Co-authored-by: Florian Apolloner Co-authored-by: Mariusz Felisiak --- tests/fixtures/tests.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'tests/fixtures') diff --git a/tests/fixtures/tests.py b/tests/fixtures/tests.py index 9eb2740c90..deac1c2d77 100644 --- a/tests/fixtures/tests.py +++ b/tests/fixtures/tests.py @@ -916,15 +916,11 @@ class FixtureLoadingTests(DumpDataAssertMixin, TestCase): with self.assertRaisesMessage(IntegrityError, msg): management.call_command("loaddata", "invalid.json", verbosity=0) - @unittest.skipUnless( - connection.vendor == "postgresql", "psycopg2 prohibits null characters in data." - ) + @skipUnlessDBFeature("prohibits_null_characters_in_text_exception") def test_loaddata_null_characters_on_postgresql(self): - msg = ( - "Could not load fixtures.Article(pk=2): " - "A string literal cannot contain NUL (0x00) characters." - ) - with self.assertRaisesMessage(ValueError, msg): + error, msg = connection.features.prohibits_null_characters_in_text_exception + msg = f"Could not load fixtures.Article(pk=2): {msg}" + with self.assertRaisesMessage(error, msg): management.call_command("loaddata", "null_character_in_field_value.json") def test_loaddata_app_option(self): -- cgit v1.3