Skip to content

Commit

Permalink
Removed obsolete test_get_or_create_raises_IntegrityError_plus_traceb…
Browse files Browse the repository at this point in the history
…ack() test.

This test was added in 31b1cbc, but is
no longer needed, as the fix was reverted in
746caf3 without any consequences, so
it now tests Python behavior rather than Django. Moreover, traceback
introspection is problematic for .pyc-only installations.
  • Loading branch information
felixxm authored Feb 21, 2024
1 parent abe6c1f commit a269d8d
Showing 1 changed file with 0 additions and 13 deletions.
13 changes: 0 additions & 13 deletions tests/get_or_create/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,19 +227,6 @@ def test_create_with_duplicate_primary_key(self):
ManualPrimaryKeyTest.objects.get_or_create(id=1, data="Different")
self.assertEqual(ManualPrimaryKeyTest.objects.get(id=1).data, "Original")

def test_get_or_create_raises_IntegrityError_plus_traceback(self):
"""
get_or_create should raise IntegrityErrors with the full traceback.
This is tested by checking that a known method call is in the traceback.
We cannot use assertRaises here because we need to inspect
the actual traceback. Refs #16340.
"""
try:
ManualPrimaryKeyTest.objects.get_or_create(id=1, data="Different")
except IntegrityError:
formatted_traceback = traceback.format_exc()
self.assertIn("obj.save", formatted_traceback)

def test_savepoint_rollback(self):
"""
The database connection is still usable after a DatabaseError in
Expand Down

0 comments on commit a269d8d

Please sign in to comment.