-
Notifications
You must be signed in to change notification settings - Fork 213
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Better error explanation for the steps defined outside of scenarios
- Loading branch information
1 parent
de0f667
commit 887dac1
Showing
4 changed files
with
35 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
"""Test no scenarios defined in the feature file.""" | ||
|
||
import textwrap | ||
|
||
|
||
def test_no_scenarios(testdir): | ||
"""Test no scenarios defined in the feature file.""" | ||
features = testdir.mkdir('features') | ||
features.join('test.feature').write_text(textwrap.dedent(u""" | ||
Given foo | ||
When bar | ||
Then baz | ||
"""), 'utf-8', ensure=True) | ||
testdir.makepyfile(""" | ||
from pytest_bdd import scenarios | ||
scenarios('features') | ||
""") | ||
result = testdir.runpytest('-v', '-s') | ||
result.stdout.fnmatch_lines( | ||
[ | ||
'*pytest_bdd.exceptions.FeatureError: Step definition outside of a Scenario or a Background.*', | ||
], | ||
) |