Fix flake8 in features branch
This commit is contained in:
parent
4fd92ef9ba
commit
7b1870a94e
|
@ -8,6 +8,7 @@ from operator import attrgetter
|
|||
from .compat import imap
|
||||
from .deprecated import MARK_INFO_ATTRIBUTE, MARK_PARAMETERSET_UNPACKING
|
||||
|
||||
|
||||
def alias(name, warning=None):
|
||||
getter = attrgetter(name)
|
||||
|
||||
|
@ -351,6 +352,7 @@ class MarkDecorator:
|
|||
mark = Mark(self.name, args, kwargs)
|
||||
return self.__class__(self.mark.combined_with(mark))
|
||||
|
||||
|
||||
def get_unpacked_marks(obj):
|
||||
"""
|
||||
obtain the unpacked marks that are stored on a object
|
||||
|
|
|
@ -281,7 +281,10 @@ class PyCollector(PyobjMixin, main.Collector):
|
|||
obj = safe_getattr(obj, '__func__', False)
|
||||
if obj is False:
|
||||
# Python 2.6 wraps in a different way that we won't try to handle
|
||||
self.warn(code="C2", message="cannot collect static method %r because it is not a function (always the case in Python 2.6)" % name)
|
||||
msg = "cannot collect static method %r because " \
|
||||
"it is not a function (always the case in Python 2.6)"
|
||||
self.warn(
|
||||
code="C2", message=msg % name)
|
||||
return False
|
||||
return (
|
||||
safe_getattr(obj, "__call__", False) and fixtures.getfixturemarker(obj) is None
|
||||
|
@ -1510,6 +1513,7 @@ class ApproxNonIterable(object):
|
|||
# the basic pytest Function item
|
||||
#
|
||||
|
||||
|
||||
class Function(FunctionMixin, main.Item, fixtures.FuncargnamesCompatAttr):
|
||||
""" a Function Item is responsible for setting up and executing a
|
||||
Python test function.
|
||||
|
|
|
@ -9,6 +9,7 @@ import _pytest._code
|
|||
|
||||
# builtin pytest.approx helper
|
||||
|
||||
|
||||
class ApproxBase(object):
|
||||
"""
|
||||
Provide shared utilities for making approximate comparisons between numbers
|
||||
|
@ -241,7 +242,7 @@ class ApproxScalar(ApproxBase):
|
|||
absolute tolerance or a relative tolerance, depending on what the user
|
||||
specified or which would be larger.
|
||||
"""
|
||||
set_default = lambda x, default: x if x is not None else default
|
||||
def set_default(x, default): return x if x is not None else default
|
||||
|
||||
# Figure out what the absolute tolerance should be. ``self.abs`` is
|
||||
# either None or a value specified by the user.
|
||||
|
@ -274,7 +275,6 @@ class ApproxScalar(ApproxBase):
|
|||
return max(relative_tolerance, absolute_tolerance)
|
||||
|
||||
|
||||
|
||||
def approx(expected, rel=None, abs=None, nan_ok=False):
|
||||
"""
|
||||
Assert that two numbers (or two sets of numbers) are equal to each other
|
||||
|
@ -593,6 +593,7 @@ def raises(expected_exception, *args, **kwargs):
|
|||
|
||||
raises.Exception = fail.Exception
|
||||
|
||||
|
||||
class RaisesContext(object):
|
||||
def __init__(self, expected_exception, message, match_expr):
|
||||
self.expected_exception = expected_exception
|
||||
|
|
|
@ -342,8 +342,7 @@ def test_getstartingblock_multiline():
|
|||
self.source = _pytest._code.Frame(frame).statement
|
||||
|
||||
x = A('x',
|
||||
'y'
|
||||
,
|
||||
'y',
|
||||
'z')
|
||||
|
||||
l = [i for i in x.source.lines if i.strip()]
|
||||
|
|
|
@ -9,6 +9,7 @@ from decimal import Decimal
|
|||
from fractions import Fraction
|
||||
inf, nan = float('inf'), float('nan')
|
||||
|
||||
|
||||
class MyDocTestRunner(doctest.DocTestRunner):
|
||||
|
||||
def __init__(self):
|
||||
|
|
|
@ -119,6 +119,7 @@ class TestNewAPI(object):
|
|||
testdir.runpytest()
|
||||
assert testdir.tmpdir.join('custom_cache_dir').isdir()
|
||||
|
||||
|
||||
def test_cache_reportheader(testdir):
|
||||
testdir.makepyfile("""
|
||||
def test_hello():
|
||||
|
|
|
@ -791,7 +791,6 @@ def test_legacy_transfer():
|
|||
def fake_method(self):
|
||||
pass
|
||||
|
||||
|
||||
transfer_markers(fake_method, FakeClass, FakeModule)
|
||||
|
||||
# legacy marks transfer smeared
|
||||
|
|
Loading…
Reference in New Issue