Fix bug when using comments in the "Examples:" section (#398)

* Fix bug when using comments in the "Examples:" section
This commit is contained in:
Alessio Bogon 2020-12-07 13:38:07 +01:00 committed by GitHub
parent 02e667f239
commit 7cb344ef64
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 3 deletions

View File

@ -1,6 +1,11 @@
Changelog
=========
4.0.2
-----
- Fix a bug that prevents using comments in the ``Examples:`` section. (youtux)
4.0.1
-----
- Fixed performance regression introduced in 4.0.0 where collection time of tests would take way longer than before. (youtux)

View File

@ -3,6 +3,6 @@
from pytest_bdd.steps import given, when, then
from pytest_bdd.scenario import scenario, scenarios
__version__ = "4.0.1"
__version__ = "4.0.2"
__all__ = [given.__name__, when.__name__, then.__name__, scenario.__name__, scenarios.__name__]

View File

@ -34,7 +34,7 @@ def split_line(line):
:return: List of strings.
"""
return [cell.replace("\\|", "|").strip() for cell in SPLIT_LINE_RE.split(line[1:-1])]
return [cell.replace("\\|", "|").strip() for cell in SPLIT_LINE_RE.split(line)[1:-1]]
def parse_line(line):

View File

@ -42,7 +42,7 @@ def test_outlined(testdir):
Examples:
| start | eat | left |
| 12 | 5 | 7 |
| 12 | 5 | 7 | # a comment
| 5 | 4 | 1 |
"""