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