Code

Opened 10 months ago

Closed 10 months ago

Last modified 10 months ago

#21099 closed Bug (fixed)

DistinctOnTests.setUp() breaks when DatabaseFeature.ignores_nulls_in_unique_constraints = True

Reported by: manfre Owned by: nobody
Component: Testing framework Version: master
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

Django-mssql doesn't implement can_distinct_on_fields, but the DistinctOnTests fail because the test setUp creates Celebrity records without specifying a value for a nullable field that has a unique constraint. Any database backend with ignores_nulls_in_unique_constraints = False will error on this setup, even if they would skip the tests.

I'm not in a position to run these tests to determine if the greatest_fan value can be set to something other than NULL.

Attachments (0)

Change History (6)

comment:1 Changed 10 months ago by manfre

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

It might be worth wrapping setUp(), or the entire class with a can_distinct_on_fields check to avoid doing the test prep work for every backend other than postgresql_psycopg2.

comment:2 Changed 10 months ago by akaariai

  • Triage Stage changed from Unreviewed to Accepted

Wrapping the whole class seems like the correct solution to me.

comment:4 Changed 10 months ago by akaariai

  • Triage Stage changed from Accepted to Ready for checkin

comment:5 Changed 10 months ago by Michael Manfre <mmanfre@…>

  • Resolution set to fixed
  • Status changed from new to closed

In 018037736fe575307f5331ebb4b126a0c886ecef:

Fixed #21099 - Skip DistinctOnTests unless backend can_distinct_on_fields

comment:6 Changed 10 months ago by Claude Paroz <claude@…>

In e4c6fca6d21f6a6d16bd69d86928270b4d2d38fb:

Merge pull request #1622 from manfre/ticket-21099

Fixed #21099 - Skip DistinctOnTests unless backend can_distinct_on_field...

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.