Opened 6 months ago

Closed 6 months ago

#33627 closed Cleanup/optimization (fixed)

model_forms.tests.ModelMultipleChoiceFieldTests.test_model_multiple_choice_field fails when running together with other cases

Reported by: Xiang Zhang Owned by: Sander Beekhuis
Component: Testing framework Version: 4.0
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

When running python3 runtests.py model_forms case model_forms.tests.ModelMultipleChoiceFieldTests.test_model_multiple_choice_field might fail:

python3 runtests.py model_forms --noinput --settings tidb_settings
  Testing against Django installed in '/home/runner/work/django-tidb/django-tidb/django_tests_dir/django/django' with up to 2 processes
  Found 177 test(s).
  Creating test database for alias 'default'...
  System check identified no issues (0 silenced).
  ...............................................................................................................F.................................................................
  ======================================================================
  FAIL: test_model_multiple_choice_field (model_forms.tests.ModelMultipleChoiceFieldTests)
  ----------------------------------------------------------------------
  Traceback (most recent call last):
    File "/home/runner/work/django-tidb/django-tidb/django_tests_dir/django/tests/model_forms/tests.py", line 2088, in test_model_multiple_choice_field
      with self.assertRaises(ValidationError):
  AssertionError: ValidationError not raised

Running it solely could succeed consistently. After some ingestion, I found the reason is the id field of model_forms_category is auto_increment. If you run the suite together, it might hit 100 by accident and then fail.

Change History (7)

comment:1 Changed 6 months ago by Sander Beekhuis

An attempt to resolve this ticket has been done in https://github.com/django/django/pull/15570

comment:2 Changed 6 months ago by Sander Beekhuis

Has patch: set

comment:3 Changed 6 months ago by Sander Beekhuis

Triage Stage: UnreviewedReady for checkin

comment:4 Changed 6 months ago by Claude Paroz

Component: UncategorizedTesting framework
Triage Stage: Ready for checkinAccepted
Type: UncategorizedCleanup/optimization

Thanks, but please do not mark your own patches as Ready for checkin. Only a reviewer should.

comment:5 Changed 6 months ago by Mariusz Felisiak

Owner: changed from nobody to Sander Beekhuis
Patch needs improvement: set
Status: newassigned

comment:6 Changed 6 months ago by Mariusz Felisiak

Patch needs improvement: unset
Triage Stage: AcceptedReady for checkin

comment:7 Changed 6 months ago by GitHub <noreply@…>

Resolution: fixed
Status: assignedclosed

In 27d52158:

Fixed #33627 -- Improved nonexistent pk in ModelMultipleChoiceFieldTests.test_model_multiple_choice_field().

Note: See TracTickets for help on using tickets.
Back to Top