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

parametrize ignores marks if parameters are symbols #2176

Closed
TristenHayfield opened this issue Jan 6, 2017 · 6 comments
Closed

parametrize ignores marks if parameters are symbols #2176

TristenHayfield opened this issue Jan 6, 2017 · 6 comments
Labels
type: bug problem that needs to be addressed type: feature-branch new feature or API change, should be merged into features branch

Comments

@TristenHayfield
Copy link

@pytest.mark.parameterize does not evaluate marks if parameters are symbols.
Here's an example:

import pytest


@pytest.mark.parametrize('v', [pytest.mark.alpha(0), pytest.mark.bravo(1)])
def test_bug(v):
    pass


def babby():
    pass

@pytest.mark.parametrize('v', [pytest.mark.alpha(babby), pytest.mark.bravo(babby)], ids=['alpha', 'bravo'])
def test_symbug(v):
    pass
$ pytest -v -s --collect-only -m alpha
====================================================================================================================== test session starts =======================================================================================================================
platform linux2 -- Python 2.7.9, pytest-3.0.5, py-1.4.32, pluggy-0.4.0 -- /home/thayfield/virtualEnvs/clean/bin/python
cachedir: .cache
rootdir: /home/thayfield/projects/hm800/tmp/pytest_bug, inifile: 
collected 4 items 
<Module 'test_bug.py'>
  <Function 'test_bug[0]'>

======================================================================================================================= 3 tests deselected =======================================================================================================================
================================================================================================================== 3 deselected in 0.01 seconds ==================================================================================================================

Missing from the above is "<Function 'test_symbug[alpha]'>"

This reproduces in a clean virtual environment with python 2.7.9 and pytest 3.0.5 installed.

$uname -a
Linux copernicus 3.16.0-4-amd64 #1 SMP Debian 3.16.36-1+deb8u2 (2016-10-19) x86_64 GNU/Linux

Is this a known issue?

@RonnyPfannschmidt
Copy link
Member

marks applied to plain functions break apart, this is a known issue - the planned solution is #1921

@RonnyPfannschmidt RonnyPfannschmidt added type: bug problem that needs to be addressed type: feature-branch new feature or API change, should be merged into features branch labels Jan 6, 2017
@nicoddemus
Copy link
Member

Should we close this? Feels like a duplicate of the known situation about markings/parametrize.

@RonnyPfannschmidt
Copy link
Member

I lost track of the original issue

@TristenHayfield
Copy link
Author

IMO duplicates can be kept open until the issue is resolved (although it depends on how well your bug-tracker can handle duplicates).

@RonnyPfannschmidt
Copy link
Member

the github issue tracker is a bare minimum product ^^

@RonnyPfannschmidt
Copy link
Member

#1921 fixed this - will be released on 3.1 or 4.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug problem that needs to be addressed type: feature-branch new feature or API change, should be merged into features branch
Projects
None yet
Development

No branches or pull requests

3 participants