Skip to content

Commit cd021db

Browse files
committed
Import Mapping and Sequence from compat in python_api::approx
Related to #3339 Fixes a DeprecationWarning on Python 3.7 Adds Mapping to compat
1 parent 6c8d46d commit cd021db

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

_pytest/compat.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@
4040

4141
if _PY3:
4242
from collections.abc import MutableMapping as MappingMixin # noqa
43-
from collections.abc import Sequence # noqa
43+
from collections.abc import Mapping, Sequence # noqa
4444
else:
4545
# those raise DeprecationWarnings in Python >=3.7
4646
from collections import MutableMapping as MappingMixin # noqa
47-
from collections import Sequence # noqa
47+
from collections import Mapping, Sequence # noqa
4848

4949

5050
def _format_args(func):

_pytest/python_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ def approx(expected, rel=None, abs=None, nan_ok=False):
426426
__ https://docs.python.org/3/reference/datamodel.html#object.__ge__
427427
"""
428428

429-
from collections import Mapping, Sequence
429+
from _pytest.compat import Mapping, Sequence
430430
from _pytest.compat import STRING_TYPES as String
431431
from decimal import Decimal
432432

0 commit comments

Comments
 (0)