diff options
author | Bruno Oliveira <nicoddemus@gmail.com> | 2017-07-17 21:05:39 -0300 |
---|---|---|
committer | Bruno Oliveira <nicoddemus@gmail.com> | 2017-07-17 21:05:39 -0300 |
commit | 4fd92ef9ba270dc5b80864b3d9b4b4d12fd779bb (patch) | |
tree | c935d577d29cc62818616f4e50c98629bdd57deb /_pytest/compat.py | |
parent | d9aaab7ab277a7a5d0716b26c728b6fc1c98469a (diff) | |
parent | b2a5ec3b9457734488dac9dd402876739985af40 (diff) | |
download | pytest-4fd92ef9ba270dc5b80864b3d9b4b4d12fd779bb.tar.gz |
Merge branch 'fix-flake8-issues' into features
Diffstat (limited to '_pytest/compat.py')
-rw-r--r-- | _pytest/compat.py | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/_pytest/compat.py b/_pytest/compat.py index 723283d6a..9cebbb974 100644 --- a/_pytest/compat.py +++ b/_pytest/compat.py @@ -10,8 +10,7 @@ import functools import py -import _pytest - +import _pytest try: @@ -59,7 +58,7 @@ def iscoroutinefunction(func): which in turns also initializes the "logging" module as side-effect (see issue #8). """ return (getattr(func, '_is_coroutine', False) or - (hasattr(inspect, 'iscoroutinefunction') and inspect.iscoroutinefunction(func))) + (hasattr(inspect, 'iscoroutinefunction') and inspect.iscoroutinefunction(func))) def getlocation(function, curdir): @@ -68,7 +67,7 @@ def getlocation(function, curdir): lineno = py.builtin._getcode(function).co_firstlineno if fn.relto(curdir): fn = fn.relto(curdir) - return "%s:%d" %(fn, lineno+1) + return "%s:%d" % (fn, lineno + 1) def num_mock_patch_args(function): @@ -79,13 +78,13 @@ def num_mock_patch_args(function): mock = sys.modules.get("mock", sys.modules.get("unittest.mock", None)) if mock is not None: return len([p for p in patchings - if not p.attribute_name and p.new is mock.DEFAULT]) + if not p.attribute_name and p.new is mock.DEFAULT]) return len(patchings) def getfuncargnames(function, startindex=None): # XXX merge with main.py's varnames - #assert not isclass(function) + # assert not isclass(function) realfunction = function while hasattr(realfunction, "__wrapped__"): realfunction = realfunction.__wrapped__ @@ -111,8 +110,7 @@ def getfuncargnames(function, startindex=None): return tuple(argnames[startindex:]) - -if sys.version_info[:2] == (2, 6): +if sys.version_info[:2] == (2, 6): def isclass(object): """ Return true if the object is a class. Overrides inspect.isclass for python 2.6 because it will return True for objects which always return @@ -298,6 +296,7 @@ else: def getvalue(self): return self.buffer.getvalue().decode('UTF-8') + class FuncargnamesCompatAttr(object): """ helper class so that Metafunc, Function and FixtureRequest don't need to each define the "funcargnames" compatibility attribute. |