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

Stop using deprecated loop argument and fix other warnings

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

      Let's fix these warnings:

      $ python3.8 -X dev setup.py test -s test.asyncio_tests.test_asyncio_cursor
      /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/setuptools/depends.py:2: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
        import imp
      setup.py:28: ResourceWarning: unclosed file <_io.TextIOWrapper name='README.rst' mode='r' encoding='UTF-8'>
        long_description = open("README.rst").read()
      ResourceWarning: Enable tracemalloc to get the object allocation traceback
      running test
      ...
      running build_ext
      /Users/shane/git/mongo-python-driver/pymongo/mongo_client.py:664: DeprecationWarning: Option 'ssl_ca_certs' is deprecated, use 'tlsCAFile' instead.
        keyword_opts = _handle_option_deprecations(keyword_opts)
      /Users/shane/git/mongo-python-driver/pymongo/mongo_client.py:664: DeprecationWarning: Option 'ssl_ca_certs' is deprecated, use 'tlsCAFile' instead.
        keyword_opts = _handle_option_deprecations(keyword_opts)
      test_aggregate_batch_size (test.asyncio_tests.test_asyncio_cursor.TestAsyncIOCursor) ... /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/asyncio/events.py:81: DeprecationWarning: The loop argument is deprecated since Python 3.8, and scheduled for removal in Python 3.10.
        self._context.run(self._callback, *self._args)
      ok
      ...
      test_count (test.asyncio_tests.test_asyncio_cursor.TestAsyncIOCursor) ... /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/asyncio/events.py:81: DeprecationWarning: The loop argument is deprecated since Python 3.8, and scheduled for removal in Python 3.10.
        self._context.run(self._callback, *self._args)
      ok
      ...
      test_exhaust (test.asyncio_tests.test_asyncio_cursor.TestAsyncIOCursor) ... /Users/shane/git/motor/test/asyncio_tests/test_asyncio_cursor.py:479: DeprecationWarning: The loop argument is deprecated since Python 3.8, and scheduled for removal in Python 3.10.
        await asyncio.sleep(0.1, loop=self.loop)
      ok
      

      To quote docs for asyncio.sleep:

      > Deprecated since version 3.8, will be removed in version 3.10: The loop parameter.

      This was changed in https://bugs.python.org/issue36373.

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

              Created:
              Updated:
              Resolved: