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
Closed

Cannot select test by mark using lower case param #3494

ay0o opened this issue May 22, 2018 · 6 comments
Labels
topic: parametrize related to @pytest.mark.parametrize type: bug problem that needs to be addressed type: docs documentation improvement, missing or needing clarification

Comments

@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

@pytestbot pytestbot added the topic: parametrize related to @pytest.mark.parametrize label May 22, 2018
@RonnyPfannschmidt
Copy link
Member

@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)

@RonnyPfannschmidt RonnyPfannschmidt added the topic: marks related to marks, either the general marks or builtin label May 22, 2018
@pytestbot
Copy link
Contributor

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).

@pytestbot pytestbot added type: bug problem that needs to be addressed type: docs documentation improvement, missing or needing clarification and removed topic: marks related to marks, either the general marks or builtin labels May 22, 2018
@ay0o
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
Copy link
Member

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

@ay0o
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 as completed May 22, 2018
@RonnyPfannschmidt
Copy link
Member

@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
Labels
topic: parametrize related to @pytest.mark.parametrize type: bug problem that needs to be addressed type: docs documentation improvement, missing or needing clarification
Projects
None yet
Development

No branches or pull requests

3 participants