Skip to content

Commit

Permalink
FIX: scenario.skip() status computation related to pull #476 (provide…
Browse files Browse the repository at this point in the history
…d by: ar45)
  • Loading branch information
jenisys committed Jul 26, 2016
1 parent 6f1b495 commit e53493c
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ CHANGES:

FIXED:

* pull #476: scenario.status when scenario without steps is skipped (provided by: ar45, jenisys)
* issue #416: JUnit report messages cut off (submitted by: remcowesterhoud, provided by: bittner)
* issue #414: Support for Jython 2.7 (submitted by: gabtwi...)
* issue #384: Active Tags fail with ScenarioOutline (submitted by: BRevzin)
Expand Down
5 changes: 3 additions & 2 deletions behave/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -642,8 +642,9 @@ def skip(self, reason=None, require_not_executed=False):
else:
assert not require_not_executed, \
"REQUIRE NOT-EXECUTED, but step is %s" % step.status
if not self.all_steps:
# -- SPECIAL CASE: Scenario without steps

scenario_without_steps = not self.steps and not self.background_steps
if scenario_without_steps:
self._cached_status = "skipped"
assert self.status in self.final_status #< skipped, failed or passed

Expand Down
39 changes: 39 additions & 0 deletions issue.features/issue0476.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
@issue
Feature: Issue #467 -- Scenario status when scenario w/o steps is skipped

. The scenario.status should be "skipped"
. if you try to skip a scenario without any steps.


Scenario: Skip scenario without steps
Given a new working directory
And a file named "features/steps/pass_steps.py" with:
"""
from behave import step
@step('{word:w} step passes')
def step_passes(context, word):
pass
"""
And a file named "features/without_steps.feature" with:
"""
Feature:
@skip_this
Scenario: Without steps
"""
And a file named "features/environment.py" with:
"""
def before_scenario(context, scenario):
if "skip_this" in scenario.tags:
scenario.skip()
"""
When I run "behave -f plain features/without_steps.feature"
Then it should pass with:
"""
Feature:
Scenario: Without steps
0 features passed, 0 failed, 1 skipped
0 scenarios passed, 0 failed, 1 skipped
"""
But note that "the scenario without steps is skipped"

0 comments on commit e53493c

Please sign in to comment.