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
I have noticed unexpected behavior when using scenario outline. Here's a simple example to demonstrate it:
File test.scenario:
Feature: Test feature
Scenario Outline: Scenario 1
When Action "A" is taken
And Some other action "<action>" is taken
Examples: Actions
| action |
| B |
File steps.py:
import pytest
from pytest_bdd import scenarios, given, when, then, parsers
scenarios('test.feature', example_converters={ 'action': str })
@when(parsers.parse('Action "{action}" is taken'))
def take_action1(action):
print('take_action1:%s'%action)
pass
@when('Some other action "<action>" is taken')
def take_action2(action):
print('take_action2:%s'%action)
pass
In this particular case I would expect to see the following in the output:
take_action1:A
take_action2:B
However, what I see is this:
take_action1:A
take_action2:A
Strangly this problem goes away if I rename action argument for one of the steps, for example:
@when(parsers.parse('Action "{action}" is taken'))
def take_action1(action):
print('take_action1:%s'%action)
pass
@when('Some other action "<action2>" is taken')
def take_action2(action2):
print('take_action2:%s'%action2)
pass
I have a feeling that arguments are somehow "cached" or memoized by name and was wondering is this expected behavior?
The text was updated successfully, but these errors were encountered:
I second this finding, I was trying to debug this for ages and changing the name to something unique fixed it. It would be great to be able to reuse the names as they're not actually used within the same context?
Hi,
I have noticed unexpected behavior when using scenario outline. Here's a simple example to demonstrate it:
File
test.scenario
:File
steps.py
:In this particular case I would expect to see the following in the output:
However, what I see is this:
Strangly this problem goes away if I rename
action
argument for one of the steps, for example:I have a feeling that arguments are somehow "cached" or memoized by name and was wondering is this expected behavior?
The text was updated successfully, but these errors were encountered: