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
dde22027
Commit
dde22027
authored
May 22, 2013
by
Gabriel Falcao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug fix by @davidsulc: tags shouldn't be parsed as steps when using backgrounds. closes #336
parent
57ac2743
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
2 deletions
+19
-2
lettuce/core.py
+4
-2
tests/unit/test_step_parsing.py
+15
-0
No files found.
lettuce/core.py
View file @
dde22027
...
...
@@ -492,8 +492,10 @@ class Step(object):
None
,
invalid_first_line_error
%
(
lines
[
0
],
'multiline'
))
# Select only lines that aren't end-to-end whitespace
lines
=
filter
(
lambda
x
:
not
REP
.
only_whitespace
.
match
(
x
),
lines
)
# Select only lines that aren't end-to-end whitespace and aren't tags
# Tags could be inclueed as steps if the first scenario following a background is tagged
# This then causes the test to fail, because lettuce looks for the step's definition (which doesn't exist)
lines
=
filter
(
lambda
x
:
not
(
REP
.
only_whitespace
.
match
(
x
)
or
re
.
match
(
r'^\s*@'
,
x
)),
lines
)
step_strings
=
[]
in_multiline
=
False
...
...
tests/unit/test_step_parsing.py
View file @
dde22027
...
...
@@ -23,6 +23,15 @@ I_HAVE_TASTY_BEVERAGES = """I have the following tasty beverages in my freezer:
"""
.
strip
()
I_DIE_HAPPY
=
"I shall die with love in my heart"
BACKGROUND_WITH_TAGGED_SCENARIO
=
'''
Background:
background line 1
@wip
Scenario:
Scenario line 1
'''
MULTI_LINE
=
'''
I have a string like so:
"""
...
...
@@ -155,6 +164,12 @@ def test_can_parse_two_ordinary_steps():
assert_equals
(
steps
[
0
]
.
sentence
,
I_DIE_HAPPY
)
assert_equals
(
steps
[
1
]
.
sentence
,
I_LIKE_VEGETABLES
)
def
test_can_parse_background_and_ignore_tag
():
"It should correctly parse and ignore tags between the background and first step."
steps
=
Step
.
many_from_lines
(
BACKGROUND_WITH_TAGGED_SCENARIO
.
splitlines
())
steps_without_tags
=
filter
(
lambda
x
:
not
x
.
sentence
==
'@wip'
,
steps
)
assert_equals
(
len
(
steps
),
len
(
steps_without_tags
))
def
test_cannot_start_with_multiline
():
"It should raise an error when a step starts with a multiline string"
lines
=
strings
.
get_stripped_lines
(
INVALID_MULTI_LINE
)
...
...
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