Move compatibility imports to compat.py and fix linting

This commit is contained in:
Bruno Oliveira 2018-03-29 18:54:30 -03:00
parent faded25ee8
commit 8ca9321940
3 changed files with 14 additions and 15 deletions

View File

@ -5,11 +5,7 @@ import pprint
import _pytest._code
import py
import six
import sys
if sys.version_info >= (3, 4):
from collections.abc import Sequence
else:
from collections import Sequence
from ..compat import Sequence
u = six.text_type

View File

@ -38,6 +38,14 @@ PY35 = sys.version_info[:2] >= (3, 5)
PY36 = sys.version_info[:2] >= (3, 6)
MODULE_NOT_FOUND_ERROR = 'ModuleNotFoundError' if PY36 else 'ImportError'
if _PY2:
# those raise DeprecationWarnings in Python >=3.7
from collections.abc import MutableMapping as MappingMixin # noqa
from collections.abc import Sequence # noqa
else:
from collections import MutableMapping as MappingMixin # noqa
from collections import Sequence # noqa
def _format_args(func):
return str(signature(func))

View File

@ -1,18 +1,13 @@
import sys
if sys.version_info >= (3, 4):
from collections.abc import MutableMapping as MappingMixin
else:
from collections import MutableMapping as MappingMixin
from collections import namedtuple
import warnings
from operator import attrgetter
import inspect
import warnings
from collections import namedtuple
from operator import attrgetter
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"