Hi,

 For testing purposes I use hook 'pytest_collection_modifyitems' to get
values of all arguments passed in parametrized test function, e.g.:

*def pytest_collection_modifyitems(items):*
*    for item in items:*
*        print item.funcargs*

with code execution example:

*{'doc': ['doc_1'], 'name': 'test_1'}*
*{'doc': ['doc_2'], 'name': 'test_2'}*
*{'doc': ['doc_3'], 'name': 'test_3'}*

 Example of code usage is attached. It works fine with pytest version 2.4.2.
 However while moving to pytest version 2.5.2 i faced the following issue:
*item.funcargs *dictionary is empty
{}
{}
{}

 Could you please clarify how can I get *funcargs *in the
'pytest_collection_modifyitems' hook in pytest 2.5.2?

Thanks in advance!
Anton
import pytest

@pytest.mark.trylast
def pytest_collection_modifyitems(items):
    for item in items:
        print item.funcargs
import pytest


class TestClass():

    argvals = [("test_1", ["doc_1", ]), ("test_2", ["doc_2", ]), ("test_3", ["doc_3", ])]

    @pytest.mark.parametrize("name, doc", argvals, ids=[x[0] for x in argvals])
    def test_params(self, name, doc):
        pass

_______________________________________________
Pytest-dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pytest-dev

Reply via email to