Opened 6 years ago

Closed 6 years ago

#29866 closed Bug (fixed)

Database teardown doesn't run if a check errors when running tests

Reported by: Jayden Kneller Owned by: Jayden Kneller
Component: Testing framework Version: dev
Severity: Normal Keywords: run_checks tests teardown database test environment
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

When running tests locally where the run_checks (new in 1.11) call fails the test database does not get torn down.

If you run the tests again you then need to type 'yes' to tear down the old database before it can continue.

Have the patch and a test created.

Change History (9)

comment:1 by Jayden Kneller, 6 years ago

Owner: changed from nobody to Jayden Kneller

comment:2 by Tim Graham, 6 years ago

Patch needs improvement: set
Summary: Teardown doesn't run if a check errors when running tests.Database teardown doesn't run if a check errors when running tests
Triage Stage: UnreviewedAccepted
Type: UncategorizedBug

PR (with comments for improvement). Please uncheck "Patch needs improvement" when it's ready for review again.

comment:3 by Jayden Kneller, 6 years ago

Patch needs improvement: unset

comment:4 by Jayden Kneller, 6 years ago

This can be reviewed again. I unchecked the Patch needs improvement checkbox as instructed.

comment:5 by Simon Charette, 6 years ago

Triage Stage: AcceptedReady for checkin

Looks good minus the minor naming tweaks.

comment:6 by Jayden Kneller, 6 years ago

Just committed your test class name, comment, and doc string changes.

The reason for the class name was because I saw "Ticket17477RegressionTests" in the same tests file and thought that was the way to do tickets.

I read through a few pages on the site before doing anything but I'm not sure I saw anything about naming or wording. I did see the past tense commit messages. Maybe a little wording/naming guideline would help. Perhaps somewhere near this section on this page: https://docs.djangoproject.com/en/2.1/internals/contributing/committing-code/#committing-guidelines

comment:8 by Jayden Kneller, 6 years ago

It was pointed out to me by someone here that there is a line about docstrings which mentions what you said on this page: https://docs.djangoproject.com/en/2.1/internals/contributing/writing-code/coding-style/

I didn't realize it would be part of that page and missed reading it.

comment:9 by Tim Graham <timograham@…>, 6 years ago

Resolution: fixed
Status: assignedclosed

In 916aecd:

Fixed #29866 -- Made DiscoverRunner do tests tear down if running checks or tests raises an exception.

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