Skip to content

Commit 8633eaa

Browse files
committed
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.
1 parent 7d81829 commit 8633eaa

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pydis_site/apps/api/tests/test_infractions.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,10 @@ def test_unique_constraint_accepts_active_infractions_for_different_users(self):
664664
)
665665

666666
def test_integrity_error_if_missing_active_field(self):
667-
pattern = 'null value in column "active" violates not-null constraint'
667+
pattern = (
668+
'null value in column "active" (of relation "api_infraction" )?'
669+
'violates not-null constraint'
670+
)
668671
with self.assertRaisesRegex(IntegrityError, pattern):
669672
Infraction.objects.create(
670673
user=self.user,

0 commit comments

Comments
 (0)