pre-commit run pyupgrade --all-files
This commit is contained in:
committed by
Bruno Oliveira
parent
3f1ec520fc
commit
a91fe1fedd
@@ -3,8 +3,6 @@ import platform
|
||||
import sys
|
||||
import traceback
|
||||
|
||||
import six
|
||||
|
||||
from ..outcomes import fail
|
||||
from ..outcomes import TEST_OUTCOME
|
||||
|
||||
@@ -22,7 +20,7 @@ def cached_eval(config, expr, d):
|
||||
return x
|
||||
|
||||
|
||||
class MarkEvaluator(object):
|
||||
class MarkEvaluator:
|
||||
def __init__(self, item, name):
|
||||
self.item = item
|
||||
self._marks = None
|
||||
@@ -86,7 +84,7 @@ class MarkEvaluator(object):
|
||||
|
||||
for expr in args:
|
||||
self.expr = expr
|
||||
if isinstance(expr, six.string_types):
|
||||
if isinstance(expr, str):
|
||||
d = self._getglobals()
|
||||
result = cached_eval(self.item.config, expr, d)
|
||||
else:
|
||||
|
||||
@@ -10,7 +10,7 @@ from _pytest.config import UsageError
|
||||
|
||||
|
||||
@attr.s
|
||||
class MarkMapping(object):
|
||||
class MarkMapping:
|
||||
"""Provides a local mapping for markers where item access
|
||||
resolves to True if the marker is present. """
|
||||
|
||||
@@ -25,7 +25,7 @@ class MarkMapping(object):
|
||||
return name in self.own_mark_names
|
||||
|
||||
|
||||
class KeywordMapping(object):
|
||||
class KeywordMapping:
|
||||
"""Provides a local mapping for keywords.
|
||||
Given a list of names, map any substring of one of these names to True.
|
||||
"""
|
||||
|
||||
@@ -5,7 +5,6 @@ from collections.abc import MutableMapping
|
||||
from operator import attrgetter
|
||||
|
||||
import attr
|
||||
import six
|
||||
|
||||
from ..compat import ascii_escaped
|
||||
from ..compat import getfslineno
|
||||
@@ -71,7 +70,7 @@ class ParameterSet(namedtuple("ParameterSet", "values, marks, id")):
|
||||
|
||||
id_ = kwargs.pop("id", None)
|
||||
if id_ is not None:
|
||||
if not isinstance(id_, six.string_types):
|
||||
if not isinstance(id_, str):
|
||||
raise TypeError(
|
||||
"Expected id to be a string, got {}: {!r}".format(type(id_), id_)
|
||||
)
|
||||
@@ -157,7 +156,7 @@ class ParameterSet(namedtuple("ParameterSet", "values, marks, id")):
|
||||
|
||||
|
||||
@attr.s(frozen=True)
|
||||
class Mark(object):
|
||||
class Mark:
|
||||
#: name of the mark
|
||||
name = attr.ib(type=str)
|
||||
#: positional arguments of the mark decorator
|
||||
@@ -180,7 +179,7 @@ class Mark(object):
|
||||
|
||||
|
||||
@attr.s
|
||||
class MarkDecorator(object):
|
||||
class MarkDecorator:
|
||||
""" A decorator for test functions and test classes. When applied
|
||||
it will create :class:`MarkInfo` objects which may be
|
||||
:ref:`retrieved by hooks as item keywords <excontrolskip>`.
|
||||
@@ -228,7 +227,7 @@ class MarkDecorator(object):
|
||||
return self.mark == other.mark if isinstance(other, MarkDecorator) else False
|
||||
|
||||
def __repr__(self):
|
||||
return "<MarkDecorator %r>" % (self.mark,)
|
||||
return "<MarkDecorator {!r}>".format(self.mark)
|
||||
|
||||
def with_args(self, *args, **kwargs):
|
||||
""" return a MarkDecorator with extra arguments added
|
||||
@@ -289,7 +288,7 @@ def store_mark(obj, mark):
|
||||
obj.pytestmark = get_unpacked_marks(obj) + [mark]
|
||||
|
||||
|
||||
class MarkGenerator(object):
|
||||
class MarkGenerator:
|
||||
""" Factory for :class:`MarkDecorator` objects - exposed as
|
||||
a ``pytest.mark`` singleton instance. Example::
|
||||
|
||||
@@ -376,11 +375,11 @@ class NodeKeywords(MutableMapping):
|
||||
return len(self._seen())
|
||||
|
||||
def __repr__(self):
|
||||
return "<NodeKeywords for node %s>" % (self.node,)
|
||||
return "<NodeKeywords for node {}>".format(self.node)
|
||||
|
||||
|
||||
@attr.s(cmp=False, hash=False)
|
||||
class NodeMarkers(object):
|
||||
class NodeMarkers:
|
||||
"""
|
||||
internal structure for storing marks belonging to a node
|
||||
|
||||
|
||||
Reference in New Issue
Block a user