Skip to content

Keyword selection expressions are limited to python syntax, which excludes some nodeids #1141

Closed
@jaysw

Description

@jaysw

Hi there.

py.test is fantastic!

I'm wondering if the following is an error, or, expected behaviour:

With the following:

@pytest.mark.parametrize('p', ['spam eggs', 'ham'])
def test_me(p):
    assert 1 == 1

This works fine:

py.test -k 'test_me[ham]'

While the following triggers an internal error / syntax error:

py.test -k 'test_me[spam eggs]'

Looks like condition here:

https://github.com/pytest-dev/pytest/blob/master/_pytest/mark.py#L154

prevents any matching on parameters having spaces in them (and falls through to an eval() call).

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: help wanteddevelopers would like help from experts on this topictopic: selectionrelated to test selection from the command linetype: backward compatibilitymight present some backward compatibility issues which should be carefully noted in the changelogtype: proposalproposal for a new feature, often to gather opinions or design the API around the new feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions