Skip to content

Commit

Permalink
Work around buggy databases = '__all__'
Browse files Browse the repository at this point in the history
  • Loading branch information
millerdev committed Jun 25, 2020
1 parent 897b3ff commit d3b8528
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion corehq/tests/noseplugins/patches.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from django.conf import settings
from nose.plugins import Plugin

from corehq.util.es.testing import patch_es_user_signals
Expand Down Expand Up @@ -30,7 +31,16 @@ def patch_django_TestCase_databases():
test with the databases it will query.
"""
from django.test import TestCase
TestCase.databases = "__all__"
# According to the docs it should be possible to allow tests to
# access all databases with `TestCase.databses = '_all__'`
# https://docs.djangoproject.com/en/2.2/topics/testing/tools/#multi-database-support
#
# Unfortunately support for '__all__' appears to be buggy:
# django.db.utils.ConnectionDoesNotExist: The connection _ doesn't exist
#
# Similar error reported elsewhere:
# https://code.djangoproject.com/ticket/30541
TestCase.databases = settings.DATABASES.keys()


GLOBAL_FREEZEGUN_IGNORE_LIST = ["kafka."]
Expand Down

0 comments on commit d3b8528

Please sign in to comment.