Opened 3 years ago

Closed 9 months ago

#21549 closed Cleanup/optimization (fixed)

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

Reported by: Michał Pasternak Owned by: Andrew Kuchev
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 Florian Apolloner

Component: UncategorizedCore (Management commands)
Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Triage Stage: UnreviewedAccepted
Version: 1.6master

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: newassigned

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 Changed 9 months ago by Tim Graham

Easy pickings: set
Owner: bugZPDX deleted
Status: assignednew
Summary: Fixture loading should fail with a BIG LOUD EXCEPTION when the file is not foundFixture loading warning when the file is not found should be an exception
Type: BugCleanup/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 9 months ago by Andrew Kuchev

Owner: set to Andrew Kuchev
Status: newassigned

comment:5 in reply to:  3 Changed 9 months ago by Andrew Kuchev

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 9 months ago by Tim Graham

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

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

Resolution: fixed
Status: assignedclosed

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