mongoengine-goodjson icon indicating copy to clipboard operation
mongoengine-goodjson copied to clipboard

Deprecation Warning When Executing Alongside Pytest

Open jusexton opened this issue 4 years ago • 7 comments

Describe the bug When importing mongoengine-goodjson or a module that consumes mongoengine-goodjson into a pytest script, a deprecation warning is raised.

DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.9 it will stop working @encode.register(collections.Iterable)

To Reproduce

  1. import mongoengine-goodjson into the same file pytest test cases will be executed
  2. run tests with pytest.
  3. Deprecation warning will be displayed

Expected behavior No deprecation warning should be displayed.

Additional context

  • It does not appear mongoengine-goodjson will be compatible with python 3.9 unless this issue is resolved.
  • I would love to raise a fix for this but its not clear how the encoder and decoder are being generated.

jusexton avatar Aug 25 '20 23:08 jusexton

Can you please attach the full warning log? This could be from a third party project or dependency.

tirkarthi avatar Sep 10 '20 14:09 tirkarthi

Below is the full log displayed in the console:

venv/lib/python3.8/site-packages/mongoengine_goodjson/encoder.py:151: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.9 it will stop working @encode.register(collections.Iterable)

If there is a method of producing more verbose logs, let me know.

jusexton avatar Sep 11 '20 01:09 jusexton

Same with me:

/home/bebeto/Projects/api-collector/venv/lib/python3.8/site-packages/mongoengine_goodjson/encoder.py:151: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.9 it will stop working
  @encode.register(collections.Iterable)
/home/bebeto/Projects/api-collector/venv/lib/python3.8/site-packages/mongoengine/queryset/base.py:399: DeprecationWarning: count is deprecated. Use Collection.count_documents instead.
  count = self._cursor.count(with_limit_and_skip=with_limit_and_skip)

bebetoalves avatar Oct 19 '20 14:10 bebetoalves

It seems these were removed in https://github.com/hiroaki-yamamoto/mongoengine-goodjson/commit/56d30c271141ce9619ceae2857367b71d34accea

tirkarthi avatar Oct 19 '20 14:10 tirkarthi

I am using version 1.1.8. Looks like 56d30c271141ce9619ceae2857367b71d34accea just barely missed the 1.1.8 release. This issue should be fixed in the next release.

jusexton avatar Oct 22 '20 05:10 jusexton

Any updates on this?

jusexton avatar Feb 27 '21 07:02 jusexton

The same for me, is there is anything I can help with to fix this issue?

vitaliimelnychuk avatar Mar 23 '21 21:03 vitaliimelnychuk