Opened 13 years ago
Closed 13 years ago
#17377 closed Bug (fixed)
Test admin_views.UserAdminTest.test_user_permission_performance depends on side effects
Reported by: | Gregor Müllegger | Owned by: | nobody |
---|---|---|---|
Component: | Uncategorized | Version: | dev |
Severity: | Normal | Keywords: | test sideeffect |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
The test admin_views.UserAdminTest.test_user_permission_performance
fails if it's run on its own. If run in conjunction with other tests, it gets a cache hit for looking up a content type. When run on it's own it needs to look that up, causing more queries than expected.
gregor@layka ~/projects/gsoc/django/tests (git)-[master] % PYTHONPATH=.. ./runtests.py --settings=test_sqlite admin_views.UserAdminTest.test_user_permission_performance Creating test database for alias 'default'... Creating test database for alias 'other'... F ====================================================================== FAIL: test_user_permission_performance (regressiontests.admin_views.tests.UserAdminTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/gregor/projects/gsoc/django/tests/regressiontests/admin_views/tests.py", line 2987, in test_user_permission_performance self.assertEqual(response.status_code, 200) File "/home/gregor/projects/gsoc/django/django/test/testcases.py", line 246, in __exit__ executed, self.num AssertionError: 8 queries executed, 7 expected ---------------------------------------------------------------------- Ran 1 test in 0.237s FAILED (failures=1) Destroying test database for alias 'default'... Destroying test database for alias 'other'... 1 gregor@layka ~/projects/gsoc/django/tests (git)-[master] % PYTHONPATH=.. ./runtests.py --settings=test_sqlite admin_views.UserAdminTest Creating test database for alias 'default'... Creating test database for alias 'other'... ...... ---------------------------------------------------------------------- Ran 6 tests in 0.718s OK Destroying test database for alias 'default'... Destroying test database for alias 'other'... gregor@layka ~/projects/gsoc/django/tests (git)-[master] % PYTHONPATH=.. ./runtests.py --settings=test_sqlite admin_views.UserAdminTest.test_user_permission_performance Creating test database for alias 'default'... Creating test database for alias 'other'... F ====================================================================== FAIL: test_user_permission_performance (regressiontests.admin_views.tests.UserAdminTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/gregor/projects/gsoc/django/tests/regressiontests/admin_views/tests.py", line 2987, in test_user_permission_performance self.assertEqual(response.status_code, 200) File "/home/gregor/projects/gsoc/django/django/test/testcases.py", line 246, in __exit__ executed, self.num AssertionError: 8 queries executed, 7 expected ---------------------------------------------------------------------- Ran 1 test in 0.228s FAILED (failures=1) Destroying test database for alias 'default'... Destroying test database for alias 'other'...
Attachments (1)
Change History (3)
by , 13 years ago
Attachment: | issue17377.1.patch added |
---|
comment:1 by , 13 years ago
Has patch: | set |
---|
Note:
See TracTickets
for help on using tickets.
Patch. https://github.com/gregmuellegger/django/tree/issue17377