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
@allure.step decorator fails if one of the method parameters has a default value #440
I have seen this too.
I assume the hook doesn't get a 'props' in this case, therefore fails. Yet, the function would be the next step after the hook, where it forces props = None making it a known variable.
Not sure if it's a bug, or working as intended, due to order of operations.
To that end, my workaround would be using a context manager for the whole step:
def send_message(
self,
channel: str,
message: str,
username: str = None,
props: Dict = None) -> None:
with allure.step(
"Send message: '{message}' on {channel} with props: '{props}'")
<code>
The problem is here - in this case only kwargs will be treated as a parameters
But actually we need to take all default parameters from function object and merge them with kwargs
Activity
mlewandowskipear commentedon Oct 31, 2019
I have seen this too.
I assume the hook doesn't get a 'props' in this case, therefore fails. Yet, the function would be the next step after the hook, where it forces
props = Nonemaking it a known variable.Not sure if it's a bug, or working as intended, due to order of operations.
To that end, my workaround would be using a context manager for the whole step:
Hope that helps for the mean time!
tanistra commentedon Oct 31, 2019
I don't know if it's a bug either.
I will try to replace decorator by your solution.
Thanks!
ocherniavskyi-lohika-tix commentedon Feb 20, 2020
The problem is here - in this case only kwargs will be treated as a parameters
But actually we need to take all default parameters from function object and merge them with kwargs
Araksya-Hambaryan commentedon May 25, 2020
Is there any updates?
Please note that the issue occurs on 2.8.15 version as well
Denis-Alexeev commentedon Mar 3, 2021
PR #569
Add an ability to pass positional args as keyword (fixes #440) (#569)
Add an ability to pass positional args as keyword (fixes allure-frame…
Add an ability to pass positional args as keyword (fixes allure-frame…