Opened 8 years ago
Closed 8 years ago
#27690 closed Cleanup/optimization (fixed)
remove sleep before dropping test db?
Reported by: | David Szotten | Owned by: | nobody |
---|---|---|---|
Component: | Testing framework | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Russell Keith-Magee | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Whilst looking at why a test run (with a small number of tests) was being slow, i discovered https://github.com/django/django/blob/master/django/db/backends/base/creation.py#L281
which calls sleep(1)
before dropping the (test) db " to avoid "database is being accessed by other users" errors.".
it looks like this line has been there since the beginning of the test framework: https://github.com/django/django/commit/7dce86ce0220ffb9f3f579cbd1e881e988764c9d
is this still needed? the few things i've tried seem to work fine without the sleep, but i'm not sure what other tests/checks might help make sure
Change History (6)
comment:1 by , 8 years ago
Cc: | added |
---|---|
Triage Stage: | Unreviewed → Accepted |
Type: | Uncategorized → Cleanup/optimization |
comment:2 by , 8 years ago
Has patch: | set |
---|---|
Triage Stage: | Accepted → Ready for checkin |
PR (will wait for any feedback before merging but I also haven't seen problems in my own testing)
comment:4 by , 8 years ago
Resolution: | fixed |
---|---|
Status: | closed → new |
Triage Stage: | Ready for checkin → Accepted |
I prepared the same change for the Oracle backend.
PR
comment:6 by , 8 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
That error message looks like PostgreSQL. I'll add Russ to Cc to see if he remembers anything about that, but I think it's worth removing it and seeing if anyone bug reports pop up. Database teardown is so much faster without it!