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
30e2008a
Commit
30e2008a
authored
Aug 27, 2011
by
Gabriel Falcão
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #178 from rbu/make-undefined-steps-fail
Use assert_raises instead of incorrect try / assert / except
parents
293dd2cc
e1ef17db
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
12 deletions
+2
-12
tests/unit/test_step_runner.py
+2
-12
No files found.
tests/unit/test_step_runner.py
View file @
30e2008a
...
@@ -440,24 +440,14 @@ def test_failing_behave_as_step_fails():
...
@@ -440,24 +440,14 @@ def test_failing_behave_as_step_fails():
def
test_undefined_behave_as_step_doesnt_pass
():
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.'
'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'
)
runnable_step
=
Step
.
from_string
(
'Given I have a step which calls the "undefined step" step with behave_as'
)
try
:
assert_raises
(
AssertionError
,
runnable_step
.
run
,
True
)
runnable_step
.
run
(
True
)
assert
False
,
"Undefined step should raise exception"
except
:
pass
assert_false
(
runnable_step
.
passed
)
assert_false
(
runnable_step
.
passed
)
@with_setup
(
step_runner_environ
)
@with_setup
(
step_runner_environ
)
def
test_undefined_behave_as_step_fails
():
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.'
'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'
)
runnable_step
=
Step
.
from_string
(
'Given I have a step which calls the "undefined step" step with behave_as'
)
try
:
assert_raises
(
AssertionError
,
runnable_step
.
run
,
True
)
runnable_step
.
run
(
True
)
assert
False
,
"Undefined step should raise exception"
except
Exception
,
e
:
pass
assert
runnable_step
.
failed
assert
runnable_step
.
failed
@with_setup
(
step_runner_environ
)
@with_setup
(
step_runner_environ
)
...
...
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