Timeouts test module not exists

I don’t see the module for timeouts.
I also searched all the *.py files under the tests directory, but don’t see the module.
Did anyone run the unit test for timeouts?
‘pytest -m timeouts’

The method is in db.py as described in the lesson quote:
" Task

For this ticket, you’ll be required to modify the connection information for MongoClient to set a write timeout of 2500 milliseconds.

The MongoClient in db.py is initialized in the get_db method.

You can add another predicate in the MongoClient for the write time out.

The tests folder contains four files which begin with test_timeouts.py but then have a further extension to them. If you rename one of these files to just be test_timeouts.py then it will be picked up in the unit testing.

I need some help to understand what happen with my code…
i tried pass on many ways to set the writeTimeOut, but i didn’t have sucess…
my last try i use the object WriteConcern import from pymongo.write_concern.

I received the error message:
pymongo.errors.ConfigurationError: Unknown option write_concern

And i check in the documentation, but i couldn’t see any example.

My code:
db = g._database = MongoClient(
# TODO: Connection Pooling
# Set the maximum connection pool size to 50 active connections.
# TODO: Timeouts
# Set the write timeout limit to 2500 milliseconds.
maxPoolSize= 50, waitQueueTimeoutMS=2500, write_concern=WriteConcern(w=“majority”, wtimeout= 2500)

Got it. Thanks, John.

I found my error. The parameters w and wtimeout need by passing without writeConcern Object…you need pass them like another parameter

1 Like