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

Gevent doctest fails because monkey.patch_all() now returns a boolean

    XMLWordPrintableJSON

Details

    • Task
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • None
    • 3.9
    • Tests
    • None

    Description

       [2019/05/20 14:50:43.306] **********************************************************************
       [2019/05/20 14:50:43.306] File "examples/gevent.rst", line 9, in default
       [2019/05/20 14:50:43.306] Failed example:
       [2019/05/20 14:50:43.306]     monkey.patch_all()
       [2019/05/20 14:50:43.306] Expected nothing
       [2019/05/20 14:50:43.306] Got:
       [2019/05/20 14:50:43.306]     True
      

      https://evergreen.mongodb.com/task/mongo_python_driver_tests_doctests__python_version~2.7_doctests_8facf001c031e9911fa56503f7738e9765f978b1_19_05_09_18_59_34

      Looks like gevent 1.4.0 changed patch_all to return a boolean which breaks our doctest:

      >>> import gevent
      >>> from gevent import monkey
      >>> monkey.patch_all()
      True
      >>> gevent.__version__
      '1.4.0'
      

      The easy fix is to either ignore the return value which will work on all versions of gevent:

        >>> _ = monkey.patch_all()
      

      Or rely on gevent 1.4+:

        >>> monkey.patch_all()
        True
      

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: