pytest-bdd
pytest-bdd copied to clipboard
Too much quoting of backslashes in datatables
trafficstars
Describe the bug
Backslashes in datatables in a feature file get converted to double backslashes in the datatable fixture dictionary.
To Reproduce
Given a feature file test.feature:
Feature: Quoting
Scenario: Backslahes are quoted correctly
Then expect backslash in datatable
| \ |
and a test file:
from pytest_bdd import scenario, then
@scenario('test.feature', 'Backslahes are quoted correctly')
def test_backslash():
pass
@then("expect backslash in datatable")
def _(datatable):
assert datatable[0][0] == '\\'
The test fails with the following output:
=========== short test summary info =================
FAILED test_backslash.py::test_backslash - AssertionError: assert '\\\\' == '\\'
- \
+ \\
=========== 1 failed in 0.05s ===========================
Expected behavior
The content of the datatable should appear exactly as in the feature file: a single backslash becomes a single backslash.
Version
- pytest version: 8.3.5
- pytest-bdd version: 8.1.0
- OS: Linux (Debian bookworm)