{"action":"created","issue":{"url":"https://api.github.com/repos/pytest-dev/pytest/issues/349","repository_url":"https://api.github.com/repos/pytest-dev/pytest","labels_url":"https://api.github.com/repos/pytest-dev/pytest/issues/349/labels{/name}","comments_url":"https://api.github.com/repos/pytest-dev/pytest/issues/349/comments","events_url":"https://api.github.com/repos/pytest-dev/pytest/issues/349/events","html_url":"https://github.com/pytest-dev/pytest/issues/349","id":88534390,"number":349,"title":"Using fixtures in pytest.mark.parametrize","user":{"login":"pytestbot","id":12873537,"avatar_url":"https://avatars.githubusercontent.com/u/12873537?v=3","gravatar_id":"","url":"https://api.github.com/users/pytestbot","html_url":"https://github.com/pytestbot","followers_url":"https://api.github.com/users/pytestbot/followers","following_url":"https://api.github.com/users/pytestbot/following{/other_user}","gists_url":"https://api.github.com/users/pytestbot/gists{/gist_id}","starred_url":"https://api.github.com/users/pytestbot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pytestbot/subscriptions","organizations_url":"https://api.github.com/users/pytestbot/orgs","repos_url":"https://api.github.com/users/pytestbot/repos","events_url":"https://api.github.com/users/pytestbot/events{/privacy}","received_events_url":"https://api.github.com/users/pytestbot/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/pytest-dev/pytest/labels/parametrize","name":"parametrize","color":"fbca04"},{"url":"https://api.github.com/repos/pytest-dev/pytest/labels/proposal","name":"proposal","color":"006b75"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":13,"created_at":"2013-08-30T19:48:51Z","updated_at":"2016-07-05T12:55:15Z","closed_at":null,"body":"Originally reported by: **Florian Rathgeber (BitBucket: [frathgeber](http://bitbucket.org/frathgeber), GitHub: [frathgeber](http://github.com/frathgeber))**\n\n----------------------------------------\n\nI often have a use case like the following contrived example:\n```python\n@pytest.fixture\ndef a():\n    return 'a'\n\n@pytest.fixture\ndef b():\n    return 'b'\n\n@pytest.mark.parametrize('arg', [a, b])\ndef test_foo(arg):\n    assert len(arg) == 1\n```\n\nThis doesn't currently do what's intended i.e. `arg` inside the test function is not the fixture *value* but the fixture *function*.\n\nI can work around it by introducing a \"meta fixture\", but that's rather ugly:\n```python\n@pytest.fixture(params=['a', 'b'])\ndef arg(request, a, b):\n    return {'a': a, 'b': b}[request.param]\n\ndef test_foo(arg):\n    assert len(arg) == 1\n```\n\nIt would be convenient if a syntax like in the first case was supported.\n\n----------------------------------------\n- Bitbucket: https://bitbucket.org/pytest-dev/pytest/issue/349\n"},"comment":{"url":"https://api.github.com/repos/pytest-dev/pytest/issues/comments/230469972","html_url":"https://github.com/pytest-dev/pytest/issues/349#issuecomment-230469972","issue_url":"https://api.github.com/repos/pytest-dev/pytest/issues/349","id":230469972,"user":{"login":"nicoddemus","id":1085180,"avatar_url":"https://avatars.githubusercontent.com/u/1085180?v=3","gravatar_id":"","url":"https://api.github.com/users/nicoddemus","html_url":"https://github.com/nicoddemus","followers_url":"https://api.github.com/users/nicoddemus/followers","following_url":"https://api.github.com/users/nicoddemus/following{/other_user}","gists_url":"https://api.github.com/users/nicoddemus/gists{/gist_id}","starred_url":"https://api.github.com/users/nicoddemus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicoddemus/subscriptions","organizations_url":"https://api.github.com/users/nicoddemus/orgs","repos_url":"https://api.github.com/users/nicoddemus/repos","events_url":"https://api.github.com/users/nicoddemus/events{/privacy}","received_events_url":"https://api.github.com/users/nicoddemus/received_events","type":"User","site_admin":false},"created_at":"2016-07-05T12:55:15Z","updated_at":"2016-07-05T12:55:15Z","body":"For reference: #1660"}}
{"actor":{"display_login":"nicoddemus"}}