From 8633eaace48a3dd6fae6af93de86e7f577475f29 Mon Sep 17 00:00:00 2001 From: Johannes Christ Date: Fri, 4 Jun 2021 23:06:32 +0200 Subject: Update `IntegrityError` pattern for PostgreSQL 13. A more specific error is raised on higher PostgreSQL versions, for example, as with the PostgreSQL version running on my local machine. This commit fixes the error message pattern matching behaviour by adding an optional match to the detailed error message. --- pydis_site/apps/api/tests/test_infractions.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pydis_site/apps/api/tests/test_infractions.py b/pydis_site/apps/api/tests/test_infractions.py index 967698ff..9aae16c0 100644 --- a/pydis_site/apps/api/tests/test_infractions.py +++ b/pydis_site/apps/api/tests/test_infractions.py @@ -664,7 +664,10 @@ class CreationTests(APISubdomainTestCase): ) def test_integrity_error_if_missing_active_field(self): - pattern = 'null value in column "active" violates not-null constraint' + pattern = ( + 'null value in column "active" (of relation "api_infraction" )?' + 'violates not-null constraint' + ) with self.assertRaisesRegex(IntegrityError, pattern): Infraction.objects.create( user=self.user, -- cgit v1.2.3