Skip to content

Commit 7cb344e

Browse files
authored
Fix bug when using comments in the "Examples:" section (#398)
* Fix bug when using comments in the "Examples:" section
1 parent 02e667f commit 7cb344e

File tree

4 files changed

+8
-3
lines changed

4 files changed

+8
-3
lines changed

CHANGES.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
Changelog
22
=========
33

4+
4.0.2
5+
-----
6+
- Fix a bug that prevents using comments in the ``Examples:`` section. (youtux)
7+
8+
49
4.0.1
510
-----
611
- Fixed performance regression introduced in 4.0.0 where collection time of tests would take way longer than before. (youtux)

pytest_bdd/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
from pytest_bdd.steps import given, when, then
44
from pytest_bdd.scenario import scenario, scenarios
55

6-
__version__ = "4.0.1"
6+
__version__ = "4.0.2"
77

88
__all__ = [given.__name__, when.__name__, then.__name__, scenario.__name__, scenarios.__name__]

pytest_bdd/parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def split_line(line):
3434
3535
:return: List of strings.
3636
"""
37-
return [cell.replace("\\|", "|").strip() for cell in SPLIT_LINE_RE.split(line[1:-1])]
37+
return [cell.replace("\\|", "|").strip() for cell in SPLIT_LINE_RE.split(line)[1:-1]]
3838

3939

4040
def parse_line(line):

tests/feature/test_outline.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def test_outlined(testdir):
4242
4343
Examples:
4444
| start | eat | left |
45-
| 12 | 5 | 7 |
45+
| 12 | 5 | 7 | # a comment
4646
| 5 | 4 | 1 |
4747
4848
"""

0 commit comments

Comments
 (0)