Skip to content

Too much quoting of backslashes in datatables #769

@lonvia

Description

@lonvia

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions