Opened 3 years ago

Closed 7 months ago

#21549 closed Cleanup/optimization (fixed)

Fixture loading warning when the file is not found should be an exception

Reported by: mpasternak Owned by: soon
Component: Core (Management commands) Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

Fixture lodaing should fail with an exception when there is no fixture file in both loaddata AND unit tests.

Any reasons, why do we silently ignore the fact of missing fixture file ATM?

If none, I can try working on a patch.

Change History (7)

comment:1 Changed 3 years ago by apollo13

  • Component changed from Uncategorized to Core (Management commands)
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted
  • Version changed from 1.6 to master

The current behavior of issuing a warning is indeed kind of odd.

comment:2 Changed 2 years ago by bugZPDX

  • Owner changed from nobody to bugZPDX
  • Status changed from new to assigned

The loaddata function in find_fixtures via load_label warns properly, however something in the interactive command is masking the error. I will continue investigating the issue.

comment:3 follow-up: Changed 7 months ago by timgraham

  • Easy pickings set
  • Owner bugZPDX deleted
  • Status changed from assigned to new
  • Summary changed from Fixture loading should fail with a BIG LOUD EXCEPTION when the file is not found to Fixture loading warning when the file is not found should be an exception
  • Type changed from Bug to Cleanup/optimization

The idea is to change the warning to CommandError. The warning about "No fixture data found" in that same file might be able to be changed as well. Some tests will need to be adapted and we'll need a mention in the release notes.

comment:4 Changed 7 months ago by soon

  • Owner set to soon
  • Status changed from new to assigned

comment:5 in reply to: ↑ 3 Changed 7 months ago by soon

Replying to timgraham:

The warning about "No fixture data found" in that same file might be able to be changed as well. Some tests will need to be adapted and we'll need a mention in the release notes.

"No fixture data found" was an error before 2013, however it has been changed to a warning with PR #799. Should it be implemented as error again?

comment:6 Changed 7 months ago by timgraham

Thanks for that research. We can keep it as is.

comment:7 Changed 7 months ago by Tim Graham <timograham@…>

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

In d5b90c8e:

Fixed #21549 -- Made loaddata's 'fixture not found' warning an exception.

Thanks to mpasternak for the report and Tim Graham for the review.

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