From 193607dda922c7199f0dc2a0775484326adeff99 Mon Sep 17 00:00:00 2001 From: Jib Date: Tue, 7 Jan 2025 15:46:11 -0500 Subject: [PATCH] disable telemetry on test suite runs --- django_mongodb/base.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/django_mongodb/base.py b/django_mongodb/base.py index 2ef34938..a052a927 100644 --- a/django_mongodb/base.py +++ b/django_mongodb/base.py @@ -1,5 +1,5 @@ import contextlib -from importlib import metadata +import os from django.core.exceptions import ImproperlyConfigured from django.db.backends.base.base import BaseDatabaseWrapper @@ -7,6 +7,7 @@ from pymongo.driver_info import DriverInfo from pymongo.mongo_client import MongoClient +from . import __version__ as django_mongodb_backend_version from . import dbapi as Database from .client import DatabaseClient from .creation import DatabaseCreation @@ -175,7 +176,9 @@ def get_new_connection(self, conn_params): return MongoClient(**conn_params, driver=self._driver_info()) def _driver_info(self): - return DriverInfo("django-mongodb", metadata.version("django-mongodb")) + if not os.environ.get("RUNNING_DJANGOS_TEST_SUITE"): + return DriverInfo("django-mongodb-backend", django_mongodb_backend_version) + return None def _commit(self): pass