mirror of
https://github.com/django/django.git
synced 2025-06-08 21:19:13 +00:00
Remove test database connection check
It doesn't work well with multiple databases configured
This commit is contained in:
parent
23a316529d
commit
975fbdfbe8
@ -9,7 +9,6 @@ from django.tasks import DEFAULT_QUEUE_NAME
|
||||
from django.tasks.exceptions import InvalidTaskError
|
||||
from django.tasks.task import MAX_PRIORITY, MIN_PRIORITY, Task
|
||||
from django.tasks.utils import is_global_function
|
||||
from django.test.testcases import _DatabaseFailure
|
||||
from django.utils import timezone
|
||||
|
||||
|
||||
@ -40,11 +39,6 @@ class BaseTaskBackend(metaclass=ABCMeta):
|
||||
if not connections.settings:
|
||||
return False
|
||||
|
||||
# If connections are disabled during tests, there's nothing to commit to
|
||||
for conn in connections.all():
|
||||
if isinstance(conn.connect, _DatabaseFailure):
|
||||
return False
|
||||
|
||||
if isinstance(task.enqueue_on_commit, bool):
|
||||
return task.enqueue_on_commit
|
||||
|
||||
|
@ -99,7 +99,7 @@ class DummyBackendTestCase(SimpleTestCase):
|
||||
await default_task_backend.aget_result("123")
|
||||
|
||||
def test_enqueue_on_commit(self):
|
||||
self.assertFalse(
|
||||
self.assertTrue(
|
||||
default_task_backend._get_enqueue_on_commit_for_task(
|
||||
test_tasks.enqueue_on_commit_task
|
||||
)
|
||||
@ -115,6 +115,8 @@ class DummyBackendTestCase(SimpleTestCase):
|
||||
|
||||
|
||||
class DummyBackendTransactionTestCase(TransactionTestCase):
|
||||
available_apps = []
|
||||
|
||||
@override_settings(
|
||||
TASKS={
|
||||
"default": {
|
||||
|
@ -171,7 +171,7 @@ class ImmediateBackendTestCase(SimpleTestCase):
|
||||
)
|
||||
|
||||
def test_enqueue_on_commit(self):
|
||||
self.assertFalse(
|
||||
self.assertTrue(
|
||||
default_task_backend._get_enqueue_on_commit_for_task(
|
||||
test_tasks.enqueue_on_commit_task
|
||||
)
|
||||
@ -186,6 +186,8 @@ class ImmediateBackendTestCase(SimpleTestCase):
|
||||
|
||||
|
||||
class ImmediateBackendTransactionTestCase(TransactionTestCase):
|
||||
available_apps = []
|
||||
|
||||
@override_settings(
|
||||
TASKS={
|
||||
"default": {
|
||||
|
Loading…
x
Reference in New Issue
Block a user