diff options
author | Bruno Oliveira <nicoddemus@gmail.com> | 2017-08-17 20:37:51 -0300 |
---|---|---|
committer | Bruno Oliveira <nicoddemus@gmail.com> | 2017-08-17 20:44:19 -0300 |
commit | a993add78331dbebdc6bc3cec8100644eaa96402 (patch) | |
tree | ca2ed642eb825d96e0d82d81eb06345d576eb6b6 /_pytest/compat.py | |
parent | 5c0c1977e36ea6b27853a609af9c69b928e2d364 (diff) | |
download | pytest-a993add78331dbebdc6bc3cec8100644eaa96402.tar.gz |
Allow tests declared as @staticmethod to use fixtures
Fix #2699
Diffstat (limited to '_pytest/compat.py')
-rw-r--r-- | _pytest/compat.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/_pytest/compat.py b/_pytest/compat.py index 45f9f86d4..eaa270a56 100644 --- a/_pytest/compat.py +++ b/_pytest/compat.py @@ -82,7 +82,10 @@ def num_mock_patch_args(function): return len(patchings) -def getfuncargnames(function, startindex=None): +def getfuncargnames(function, startindex=None, cls=None): + if startindex is None and cls is not None: + is_staticmethod = isinstance(cls.__dict__.get(function.__name__, None), staticmethod) + startindex = 0 if is_staticmethod else 1 # XXX merge with main.py's varnames # assert not isclass(function) realfunction = function |