Skip to content

Commit e092a7f

Browse files
committed
Fix issues with tests failing under Django 2.2
1 parent be3f652 commit e092a7f

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

django_prometheus/tests/end2end/testapp/test_db.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,14 @@
66
from django_prometheus.testutils import PrometheusTestCaseMixin
77

88

9+
class BaseDbMetricTest(PrometheusTestCaseMixin, TestCase):
10+
# https://docs.djangoproject.com/en/2.2/topics/testing/tools/#django.test.SimpleTestCase.databases
11+
databases = '__all__'
12+
13+
914
@skipUnless(connections['test_db_1'].vendor == 'sqlite',
1015
"Skipped unless test_db_1 uses sqlite")
11-
class TestDbMetrics(PrometheusTestCaseMixin, TestCase):
16+
class TestDbMetrics(BaseDbMetricTest):
1217
"""Test django_prometheus.db metrics.
1318
1419
Note regarding the values of metrics: many tests interact with the
@@ -59,7 +64,7 @@ def testExecuteMany(self):
5964

6065
@skipUnless('postgresql' in connections,
6166
"Skipped unless postgresql database is enabled")
62-
class TestPostgresDbMetrics(PrometheusTestCaseMixin, TestCase):
67+
class TestPostgresDbMetrics(BaseDbMetricTest):
6368
"""Test django_prometheus.db metrics for postgres backend.
6469
6570
Note regarding the values of metrics: many tests interact with the
@@ -82,7 +87,7 @@ def testCounters(self):
8287

8388
@skipUnless('mysql' in connections,
8489
"Skipped unless mysql database is enabled")
85-
class TestMysDbMetrics(PrometheusTestCaseMixin, TestCase):
90+
class TestMysDbMetrics(BaseDbMetricTest):
8691
"""Test django_prometheus.db metrics for mys backend.
8792
8893
Note regarding the values of metrics: many tests interact with the

0 commit comments

Comments
 (0)