Uploaded image for project: 'Motor'
  1. Motor
  2. MOTOR-598

Fix doctest failures

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 2.2
    • Affects Version/s: None
    • Component/s: None
    • None

       [2020/08/06 20:17:46.730] WARNING: **********************************************************************
       [2020/08/06 20:17:46.730] File "../motor/motor_asyncio.py", line ?, in sort
       [2020/08/06 20:17:46.730] Failed example:
       [2020/08/06 20:17:46.730]     @gen.coroutine
       [2020/08/06 20:17:46.730]     def f():
       [2020/08/06 20:17:46.730]         cursor = collection.find().sort('_id', pymongo.DESCENDING)
       [2020/08/06 20:17:46.730]         docs = await cursor.to_list(None)
       [2020/08/06 20:17:46.730]         print([d['_id'] for d in docs])
       [2020/08/06 20:17:46.730] Exception raised:
       [2020/08/06 20:17:46.730]     Traceback (most recent call last):
       [2020/08/06 20:17:46.730]       File "/opt/python/3.6/lib/python3.6/doctest.py", line 1330, in __run
       [2020/08/06 20:17:46.730]         compileflags, 1), test.globs)
       [2020/08/06 20:17:46.730]       File "/data/mci/44553ece43d10434bbb82f6162f8c3b5/src/.tox/py3-sphinx-doctest/lib/python3.6/site-packages/sphinx/ext/doctest.py", line 476, in compile
       [2020/08/06 20:17:46.730]         return compile(code, name, self.type, flags, dont_inherit)
       [2020/08/06 20:17:46.730]       File "<doctest sort[0]>", line 4
       [2020/08/06 20:17:46.730]         docs = await cursor.to_list(None)
       [2020/08/06 20:17:46.730]                           ^
       [2020/08/06 20:17:46.730]     SyntaxError: invalid syntax
      
       [2020/08/06 20:17:47.459] WARNING: **********************************************************************
       [2020/08/06 20:17:47.459] File "../motor/motor_asyncio.py", line ?, in sort_text
       [2020/08/06 20:17:47.459] Failed example:
       [2020/08/06 20:17:47.459]     @gen.coroutine
       [2020/08/06 20:17:47.459]     def f():
       [2020/08/06 20:17:47.459]         cursor = collection.find({
       [2020/08/06 20:17:47.459]             '$text': {'$search': 'some words'}},
       [2020/08/06 20:17:47.459]             {'score': {'$meta': 'textScore'}})
       [2020/08/06 20:17:47.459]         # Sort by 'score' field.
       [2020/08/06 20:17:47.459]         cursor.sort([('score', {'$meta': 'textScore'})])
       [2020/08/06 20:17:47.459]         docs = await cursor.to_list(None)
       [2020/08/06 20:17:47.459]         for doc in docs:
       [2020/08/06 20:17:47.459]             print('%.1f %s' % (doc['score'], doc['field']))
       [2020/08/06 20:17:47.459] Exception raised:
       [2020/08/06 20:17:47.459]     Traceback (most recent call last):
       [2020/08/06 20:17:47.459]       File "/opt/python/3.6/lib/python3.6/doctest.py", line 1330, in __run
       [2020/08/06 20:17:47.459]         compileflags, 1), test.globs)
       [2020/08/06 20:17:47.459]       File "/data/mci/44553ece43d10434bbb82f6162f8c3b5/src/.tox/py3-sphinx-doctest/lib/python3.6/site-packages/sphinx/ext/doctest.py", line 476, in compile
       [2020/08/06 20:17:47.459]         return compile(code, name, self.type, flags, dont_inherit)
       [2020/08/06 20:17:47.459]       File "<doctest sort_text[0]>", line 9
       [2020/08/06 20:17:47.459]         docs = await cursor.to_list(None)
       [2020/08/06 20:17:47.459]                           ^
       [2020/08/06 20:17:47.459]     SyntaxError: invalid syntax
       [2020/08/06 20:17:47.459] WARNING: **********************************************************************
       [2020/08/06 20:17:47.459] File "../motor/motor_asyncio.py", line ?, in sort_text
       [2020/08/06 20:17:47.459] Failed example:
       [2020/08/06 20:17:47.459]     IOLoop.current().run_sync(f)
       [2020/08/06 20:17:47.459] Exception raised:
       [2020/08/06 20:17:47.459]     Traceback (most recent call last):
       [2020/08/06 20:17:47.459]       File "/opt/python/3.6/lib/python3.6/doctest.py", line 1330, in __run
       [2020/08/06 20:17:47.459]         compileflags, 1), test.globs)
       [2020/08/06 20:17:47.459]       File "<doctest sort_text[1]>", line 1, in <module>
       [2020/08/06 20:17:47.459]         IOLoop.current().run_sync(f)
       [2020/08/06 20:17:47.459]     NameError: name 'f' is not defined
      

      https://evergreen.mongodb.com/task/motor_doctests_doctest_42b48d89a3955838d2b19415b9641dbc5ef9eb8f_20_08_06_19_09_28

            Assignee:
            prashant.mital Prashant Mital (Inactive)
            Reporter:
            shane.harvey@mongodb.com Shane Harvey
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: