-
Notifications
You must be signed in to change notification settings - Fork 215
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
e46e77f
commit eac2c9f
Showing
4 changed files
with
37 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,26 @@ | ||
"""Test no scenarios defined in the feature file.""" | ||
|
||
import py | ||
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(py.code.Source(""" | ||
from pytest_bdd import scenarios | ||
scenarios('features') | ||
""")) | ||
result = testdir.runpytest() | ||
result.stdout.fnmatch_lines( | ||
[ | ||
'*FeatureError: Step definition outside of a Scenario or a Background.*', | ||
], | ||
) |