#36083: TransactionTestCase available_apps not set correctly for parallel test
runner
-------------------------------------+-------------------------------------
Reporter: Adam Zapletal | Owner: (none)
Type: Bug | Status: new
Component: Testing framework | Version: dev
Severity: Release blocker | Resolution:
Keywords: TransactionTestCase | Triage Stage: Accepted
setupclass available_apps |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Jacob Walls):
* keywords: => TransactionTestCase setupclass available_apps
* severity: Normal => Release blocker
* stage: Unreviewed => Accepted
* summary: tests.file_storage.tests can fail when run in isolation =>
TransactionTestCase available_apps not set correctly for parallel test
runner
Comment:
Thanks, I remember replying on Discord that I could reproduce this.
Bisected to a060a22ee2dde7aa29a5a29120087c4864887325. Hey, that was me!
Looks like some debugging is needed around why
`apps.set_available_apps(cls.available_apps)` is not being called at a
point that works for the parallel test runner.
Would you like to look into this a little bit? I'm marking as a release
blocker, and since the alpha is scheduled to go out this week, I can make
some time to investigate as well. Having a couple people look at it will
be helpful.
----
RE: your original proposal, I think we have another option, which would be
to do this, but I think you're right this is just masking the deeper
issue:
{{{#!diff
diff --git a/tests/file_storage/tests.py b/tests/file_storage/tests.py
index 5f0024b81a..86429ec3a8 100644
--- a/tests/file_storage/tests.py
+++ b/tests/file_storage/tests.py
@@ -30,6 +30,7 @@ from django.test import (
SimpleTestCase,
TestCase,
ignore_warnings,
+ modify_settings,
override_settings,
)
from django.test.utils import requires_tz_support
@@ -1233,6 +1234,7 @@ class ContentFileStorageTestCase(unittest.TestCase):
@override_settings(ROOT_URLCONF="file_storage.urls")
+@modify_settings(MIDDLEWARE={"remove":
"django.contrib.auth.middleware.AuthenticationMiddleware"})
class FileLikeObjectTestCase(LiveServerTestCase):
"""
Test file-like objects (#15644).
}}}
--
Ticket URL: <
https://code.djangoproject.com/ticket/36083#comment:1>
Django <
https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.