mongoengine-goodjson
mongoengine-goodjson copied to clipboard
Deprecation Warning When Executing Alongside Pytest
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
- import
mongoengine-goodjson
into the same file pytest test cases will be executed - run tests with
pytest
. - 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.
Can you please attach the full warning log? This could be from a third party project or dependency.
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.
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)
It seems these were removed in https://github.com/hiroaki-yamamoto/mongoengine-goodjson/commit/56d30c271141ce9619ceae2857367b71d34accea
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.
Any updates on this?
The same for me, is there is anything I can help with to fix this issue?