Opened 3 years ago

Closed 13 months ago

#18320 closed Bug (worksforme)

Unit test model_formsets_regress.FormsetTests.test_extraneous_query_is_not_run expects wrong number of queries

Reported by: manfre Owned by: nobody
Component: Testing framework Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

For database backends with feature can_return_id_from_insert = False, there should be an expected second query, which fetches the newly inserted pk.

Attachments (2)

django-ticket18320.diff (1.1 KB) - added by manfre 3 years ago.
Check conection features to determine proper num of expected queries.
django-ticket18320.2.diff (1.5 KB) - added by manfre 3 years ago.
Added feature 'query_needed_to_fetch_return_id'

Download all attachments as: .zip

Change History (7)

Changed 3 years ago by manfre

Check conection features to determine proper num of expected queries.

comment:1 Changed 3 years ago by akaariai

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

Looks good. But why does this test not fail on any of core backends?

Not marking as RFC as I haven't actually applied the patch.

comment:2 Changed 3 years ago by manfre

  • Patch needs improvement set

You raised a valid question. can_return_id_from_insert = False does not necessarily imply that a separate query is needed to fetch the return_id. Updating patch pending.

Changed 3 years ago by manfre

Added feature 'query_needed_to_fetch_return_id'

comment:3 Changed 3 years ago by manfre

  • Patch needs improvement unset

The other backends are able to pull the insert id from the cursor without an additional query.

comment:4 Changed 13 months ago by timo

Is this still desired or did you find another solution in the past 2 years? It looks like it was just forgotten.

comment:5 Changed 13 months ago by manfre

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

I found another solution and forgot about this case. Closing.

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