diff --git a/tests/modeltests/validation/models.py b/tests/modeltests/validation/models.py index 0adc9fec32..26fff4b863 100644 --- a/tests/modeltests/validation/models.py +++ b/tests/modeltests/validation/models.py @@ -101,6 +101,6 @@ try: class MultipleAutoFields(models.Model): auto1 = models.AutoField(primary_key=True) auto2 = models.AutoField(primary_key=True) -except AssertionError as assertion_error: - pass # Fail silently +except AssertionError as exc: + assertion_error = exc assert str(assertion_error) == "A model can't have more than one AutoField."