Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot select test by mark using lower case param #3494

Closed
ay0o opened this Issue May 22, 2018 · 6 comments

Comments

Projects
None yet
3 participants
@ay0o
Copy link

ay0o commented May 22, 2018

import pytest

@pytest.mark.parametrize('kind', [
    pytest.param('integration', marks=[pytest.mark.integration]),
    pytest.param('stability', marks=[pytest.mark.stability]),
])
def test_foo(kind):
    assert kind == 'integration'

If I run for example pytest -m integration, it won't select any test. However, if I edit the param and make it uppercase, it works fine. So, above code doesn't work, but the below works:

import pytest

@pytest.mark.parametrize('kind', [
    pytest.param('INTEGRATION', marks=[pytest.mark.integration]),
    pytest.param('STABILITY', marks=[pytest.mark.stability]),
])
def test_foo(kind):
    assert kind == 'INTEGRATION'

I can successfully run pytest -m integration and only integration will be used. Likewise, pytest -m stability selects only stability.

I don't see any constraints about upper case characters in the documentation, in fact, the examples use params in lower case, so I suppose this is a bug.

Software:
Python 3.6.4
pytest 3.5.1

@RonnyPfannschmidt

This comment has been minimized.

Copy link
Member

RonnyPfannschmidt commented May 22, 2018

@ay0o this is possibly one of the mark issues, can you please verify if it happens on the features branch as well (there we changed some things to be more correct)

@pytestbot

This comment has been minimized.

Copy link

pytestbot commented May 22, 2018

GitMate.io thinks possibly related issues are #552 (Can't mark.xfail a callable test param), #50 (Select tests according to their mark), #3100 (Cannot dynamically mark a test as xfail), #2355 (using pytest.mark.skipIf doesn't skip anything, but calling pytest.mark.skipif (all lower case) works), and #3368 (Applying multiple skipifs to parametrized test using param(marks=[]) is order dependent).

@ay0o

This comment has been minimized.

Copy link
Author

ay0o commented May 22, 2018

Hi @RonnyPfannschmidt, how can I use the version in the features branch? Is there any package I can just pip install?

@RonnyPfannschmidt

This comment has been minimized.

Copy link
Member

RonnyPfannschmidt commented May 22, 2018

you can pip install the feature branch either from a git checkout, or via a pip scm url that clones the repo

@ay0o

This comment has been minimized.

Copy link
Author

ay0o commented May 22, 2018

ok, confirmed it's fixed in the branch "features".

Is there any expected release date?

@ay0o ay0o closed this May 22, 2018

@RonnyPfannschmidt

This comment has been minimized.

Copy link
Member

RonnyPfannschmidt commented May 22, 2018

@ay0o we aim to release this week, thanks for verifying

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.