-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
deprecation warnings when imported on python 3.7 beta #3339
Comments
GitMate.io thinks possibly related issues are #2191 (add an option to warn about Python 3.x possible incompatibilities), #2118 (pytest triggering deprecation warnings in 3.0.5), #2327 (capsys not capturing on Python 2.7), #2674 ( |
Thanks @irmen for the report! |
this si a easy fix - we need to try to import from collections.abc first |
collections.abc is easy, but the problem with changing imp to importlib: pytest stops with error:
|
lets fix the easily fixable first then ^^ i wont have time to investigate soonish |
i just tried to fix imp importing, its not actually easy as things are named differently and it needs help on python3 we might need to drop python2 support or spend quite some time for a compat layer |
For Serpent, I fixed it with a simple version check like this: |
@irmen thats good for the abc one ^^ up for making that pr for pytest module? |
Sure I'm not familiar with the Pytest code base yet but this shouldn't be too hard. |
note that at least |
I'm not able to fix the deprecation warnings from using the |
@irmen correct, its quite tricky, please dont try unless you are fluent - i fear we might need to port to importlib/importlib2 in general |
I agree with @RonnyPfannschmidt, that bit is quite tricky I'm afraid. |
We've got a lot of tests failures in Fedora because of this:
...
We run the testsuite as:
Any hack to get rid of such failures? I've been trying to use -W ignore::DeprecationWarning but it didn't help. Thanks |
@hroncok this has been released in Not sure why you are still seeing this warnings, here's the code: Lines 41 to 47 in 8e17e32
|
This is 3.5.1, that's the weird thing. |
this is in master: Line 429 in 8e17e32
|
testing with: diff --git a/_pytest/compat.py b/_pytest/compat.py
index a5fa037..1a4b750 100644
--- a/_pytest/compat.py
+++ b/_pytest/compat.py
@@ -40,11 +40,11 @@ MODULE_NOT_FOUND_ERROR = 'ModuleNotFoundError' if PY36 else 'ImportError'
if _PY3:
from collections.abc import MutableMapping as MappingMixin # noqa
- from collections.abc import Sequence # noqa
+ from collections.abc import Mapping, Sequence # noqa
else:
# those raise DeprecationWarnings in Python >=3.7
from collections import MutableMapping as MappingMixin # noqa
- from collections import Sequence # noqa
+ from collections import Mapping, Sequence # noqa
def _format_args(func):
diff --git a/_pytest/python_api.py b/_pytest/python_api.py
index 8e09a4a..838a4a5 100644
--- a/_pytest/python_api.py
+++ b/_pytest/python_api.py
@@ -426,7 +426,7 @@ def approx(expected, rel=None, abs=None, nan_ok=False):
__ https://docs.python.org/3/reference/datamodel.html#object.__ge__
"""
- from collections import Mapping, Sequence
+ from _pytest.compat import Mapping, Sequence
from _pytest.compat import STRING_TYPES as String
from decimal import Decimal
(Edited to add Mapping to compat) |
that one needs to go into 3.6 |
@hroncok would you like to open a PR? If we can get this into 3.6 it would be great. |
I'm still testing a build, because the first patch was incomplete. A PR is incoming, just want to confirm it fixes the problem. |
succeeded! |
@hroncok please provide a pr - we'd like to include in the next release which is due today or early tommorow |
Related to pytest-dev#3339 Fixes a DeprecationWarning on Python 3.7 Adds Mapping to compat
Related to pytest-dev#3339 Fixes a DeprecationWarning on Python 3.7 Adds Mapping to compat
I said I'm working on it. Here it is #3497 |
Related to pytest-dev#3339 Fixes a DeprecationWarning on Python 3.7 Adds Mapping to compat
Related to pytest-dev#3339 Fixes a DeprecationWarning on Python 3.7 Adds Mapping to compat
We can close this now, the Thanks everyone! |
Also reported in boto/botocore#1615 |
Python 3.7 will introduce a few new API deprecation warnings. They're triggered when importing pytest on python 3.7 beta:
pytest version: 3.5.0
python version: cpython 3.7 built from source (3.7 branch)
OS: debian 9
The text was updated successfully, but these errors were encountered: