Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-1644

Doctests fail with "not master"

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 3.8
    • Affects Version/s: None
    • Component/s: Tests
    • Labels:
      None

      The doctests fail when the replica set primary is not on the default port:

       [2018/09/13 15:53:37.355] Document: examples/datetimes
       [2018/09/13 15:53:37.355] ----------------------------
       [2018/09/13 15:53:37.363] **********************************************************************
       [2018/09/13 15:53:37.363] Line 1, in default (setup code)
       [2018/09/13 15:53:37.363] Failed example:
       [2018/09/13 15:53:37.363]     from pymongo.mongo_client import MongoClient
       [2018/09/13 15:53:37.363]     client = MongoClient()
       [2018/09/13 15:53:37.363]     client.drop_database("doctest_test")
       [2018/09/13 15:53:37.363]     db = client.doctest_test
       [2018/09/13 15:53:37.363] Exception raised:
       [2018/09/13 15:53:37.363]     Traceback (most recent call last):
       [2018/09/13 15:53:37.363]       File "/opt/python/3.4/lib/python3.4/doctest.py", line 1318, in __run
       [2018/09/13 15:53:37.363]         compileflags, 1), test.globs)
       [2018/09/13 15:53:37.363]       File "<doctest default (setup code)[0]>", line 4, in <module>
       [2018/09/13 15:53:37.363]         client.drop_database("doctest_test")
       [2018/09/13 15:53:37.363]       File "/data/mci/97ecd4d12df46c72d0c9d49f61a05c68/src/pymongo/mongo_client.py", line 1742, in drop_database
       [2018/09/13 15:53:37.363]         session=session)
       [2018/09/13 15:53:37.363]       File "/data/mci/97ecd4d12df46c72d0c9d49f61a05c68/src/pymongo/database.py", line 514, in _command
       [2018/09/13 15:53:37.363]         client=self.__client)
       [2018/09/13 15:53:37.363]       File "/data/mci/97ecd4d12df46c72d0c9d49f61a05c68/src/pymongo/pool.py", line 583, in command
       [2018/09/13 15:53:37.363]         self._raise_connection_failure(error)
       [2018/09/13 15:53:37.363]       File "/data/mci/97ecd4d12df46c72d0c9d49f61a05c68/src/pymongo/pool.py", line 744, in _raise_connection_failure
       [2018/09/13 15:53:37.363]         raise error
       [2018/09/13 15:53:37.363]       File "/data/mci/97ecd4d12df46c72d0c9d49f61a05c68/src/pymongo/pool.py", line 578, in command
       [2018/09/13 15:53:37.363]         unacknowledged=unacknowledged)
       [2018/09/13 15:53:37.363]       File "/data/mci/97ecd4d12df46c72d0c9d49f61a05c68/src/pymongo/network.py", line 150, in command
       [2018/09/13 15:53:37.363]         parse_write_concern_error=parse_write_concern_error)
       [2018/09/13 15:53:37.363]       File "/data/mci/97ecd4d12df46c72d0c9d49f61a05c68/src/pymongo/helpers.py", line 132, in _check_command_response
       [2018/09/13 15:53:37.363]         raise NotMasterError(errmsg, response)
       [2018/09/13 15:53:37.363]     pymongo.errors.NotMasterError: not master
      

      One way to fix this would be to run the tests against a single member replica set instead of a 3 member set.

      Another way would be to discover the replica set name and connect to the entire replica set in our doctest_global_setup.

            Assignee:
            shane.harvey@mongodb.com Shane Harvey
            Reporter:
            shane.harvey@mongodb.com Shane Harvey
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: