Skip to content
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

change collections.abc import to fix deprecation warnings on python 3.7 #3355

Merged
merged 4 commits into from
Apr 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion _pytest/assertion/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import _pytest._code
import py
import six
from collections import Sequence
from ..compat import Sequence

u = six.text_type

Expand Down
8 changes: 8 additions & 0 deletions _pytest/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@
PY36 = sys.version_info[:2] >= (3, 6)
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
else:
# those raise DeprecationWarnings in Python >=3.7
from collections import MutableMapping as MappingMixin # noqa
from collections import Sequence # noqa


def _format_args(func):
return str(signature(func))
Expand Down
8 changes: 4 additions & 4 deletions _pytest/mark/structures.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
from collections import namedtuple, MutableMapping as MappingMixin
import inspect
import warnings
from collections import namedtuple
from operator import attrgetter
import inspect

import attr
from ..deprecated import MARK_PARAMETERSET_UNPACKING
from ..compat import NOTSET, getfslineno
from six.moves import map

from ..compat import NOTSET, getfslineno, MappingMixin
from ..deprecated import MARK_PARAMETERSET_UNPACKING

EMPTY_PARAMETERSET_OPTION = "empty_parameter_set_mark"

Expand Down
1 change: 1 addition & 0 deletions changelog/3339.trivial
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Import some modules from ``collections`` instead of ``collections.abc`` as the former modules trigger ``DeprecationWarning`` in Python 3.7.