I found the same error. For my case using Python 3.12
The error occur during unit test (I don’t know about production since it don’t have any effect)
I use pytest to run test and the error appear after the test report
MongoClient has been call at the beginning of the test via fixture, the fixture function is here
@pytest.fixture(scope="session", autouse=True)
def mongo_connect(settings: Settings) :
client = settings.get_mongo_client() # MongoConnect here
set_mongo_database(settings.get_mongo_db()) # set db to environment
yield
client.close()