You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support test functions that are located inside classes #16
It would be non-trivial to fix this: indeed the way we currently generate the wrappers around test functions is done with a hacked version of decorator to add arguments in the signature, and the only way I found as of today is to prepend the new arguments at the beginning of the positional arguments in the new signature.
When a function is located inside a class, its first argument is 'self' or 'cls', and should remain the first argument, even after our wrapping.
We could however inspect the test functions and detect that it is an instance, class or static method, so that we handle the case specifically.
Thanks for caring! As of today as I wrote above, this would require a major non-trivial modification.
A workaround is to use the "new" pytest style (i.e. no classes, just plain old functions in separate modules). But I understand that in large projects this might not be satisfying.
I would gladly accept contributions on the topic if anyone feels ready to dig into dynamic code compilation.
changed the title [-]ValueError: <function TestClass.test_xxx> uses no argument '________step_name_'[/-][+]Support test functions that are located inside classes[/+]on Dec 13, 2018
Activity
smarie commentedon Nov 15, 2018
It would be non-trivial to fix this: indeed the way we currently generate the wrappers around test functions is done with a hacked version of
decoratorto add arguments in the signature, and the only way I found as of today is to prepend the new arguments at the beginning of the positional arguments in the new signature.When a function is located inside a class, its first argument is 'self' or 'cls', and should remain the first argument, even after our wrapping.
We could however inspect the test functions and detect that it is an instance, class or static method, so that we handle the case specifically.
Let's wait for users actually requiring it :)
New test for future fixes of issue #16
rplevka commentedon Nov 20, 2018
uhm...here i am :D
smarie commentedon Nov 20, 2018
Thanks for caring! As of today as I wrote above, this would require a major non-trivial modification.
A workaround is to use the "new" pytest style (i.e. no classes, just plain old functions in separate modules). But I understand that in large projects this might not be satisfying.
I would gladly accept contributions on the topic if anyone feels ready to dig into dynamic code compilation.
[-]ValueError: <function TestClass.test_xxx> uses no argument '________step_name_'[/-][+]Support test functions that are located inside classes[/+]zeburek commentedon Oct 28, 2019
Looks like a MUSTHAVE feature
smarie commentedon Nov 5, 2019
It seems that this is doable quite easily with current status of the code (now that I rely on
makefundo manipulate the signatures). I'll have a look.smarie commentedon Nov 5, 2019
Fixed in
1.7.0(to be released in a few minutes)