Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lettuce
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
lettuce
Commits
ccf9c8e7
Commit
ccf9c8e7
authored
Aug 25, 2011
by
Robert Buchholz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make Step.behave_as fail when calling an undefined step
parent
fed98379
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
6 deletions
+30
-6
lettuce/core.py
+6
-6
tests/unit/test_step_runner.py
+24
-0
No files found.
lettuce/core.py
View file @
ccf9c8e7
...
@@ -356,15 +356,15 @@ class Step(object):
...
@@ -356,15 +356,15 @@ class Step(object):
for
step
in
steps
:
for
step
in
steps
:
step
.
scenario
=
self
.
scenario
step
.
scenario
=
self
.
scenario
(
_
,
_
,
steps_failed
,
_
,
_
)
=
self
.
run_all
(
steps
)
(
_
,
_
,
steps_failed
,
steps_undefined
,
_
)
=
self
.
run_all
(
steps
)
if
not
steps_failed
:
if
not
steps_failed
and
not
steps_undefined
:
self
.
passed
=
True
self
.
passed
=
True
self
.
failed
=
False
self
.
failed
=
False
return
self
.
passed
return
self
.
passed
else
:
self
.
passed
=
False
self
.
passed
=
Fals
e
self
.
failed
=
Tru
e
self
.
failed
=
True
assert
not
steps_failed
,
steps_failed
[
0
]
.
why
.
exception
assert
not
steps_failed
,
steps_failed
[
0
]
.
why
.
exception
assert
not
steps_undefined
,
"Undefined step:
%
s"
%
steps_undefined
[
0
]
.
sentence
def
run
(
self
,
ignore_case
):
def
run
(
self
,
ignore_case
):
"""Runs a step, trying to resolve it on available step
"""Runs a step, trying to resolve it on available step
...
...
tests/unit/test_step_runner.py
View file @
ccf9c8e7
...
@@ -437,6 +437,30 @@ def test_failing_behave_as_step_fails():
...
@@ -437,6 +437,30 @@ def test_failing_behave_as_step_fails():
assert
runnable_step
.
failed
assert
runnable_step
.
failed
@with_setup
(
step_runner_environ
)
@with_setup
(
step_runner_environ
)
def
test_undefined_behave_as_step_doesnt_pass
():
'When a step definition calls an undefined step definition with behave_as, that step should not be marked as success.'
runnable_step
=
Step
.
from_string
(
'Given I have a step which calls the "undefined step" step with behave_as'
)
try
:
runnable_step
.
run
(
True
)
assert
False
,
"Undefined step should raise exception"
except
:
pass
assert_false
(
runnable_step
.
passed
)
@with_setup
(
step_runner_environ
)
def
test_undefined_behave_as_step_fails
():
'When a step definition calls an undefined step definition with behave_as, that step should be marked a failure.'
runnable_step
=
Step
.
from_string
(
'Given I have a step which calls the "undefined step" step with behave_as'
)
try
:
runnable_step
.
run
(
True
)
assert
False
,
"Undefined step should raise exception"
except
Exception
,
e
:
pass
assert
runnable_step
.
failed
@with_setup
(
step_runner_environ
)
def
test_failing_behave_as_step_raises_assertion
():
def
test_failing_behave_as_step_raises_assertion
():
'When a step definition calls another (failing) step definition with behave_as, that step should be marked a failure.'
'When a step definition calls another (failing) step definition with behave_as, that step should be marked a failure.'
runnable_step
=
Step
.
from_string
(
'Given I have a step which calls the "other step fails" step with behave_as'
)
runnable_step
=
Step
.
from_string
(
'Given I have a step which calls the "other step fails" step with behave_as'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment