From 877ca5a0bf50bd9406d7cea3f7b4d595071d7bd1 Mon Sep 17 00:00:00 2001 From: palaviv Date: Sat, 19 Mar 2016 21:38:24 +0200 Subject: [PATCH] added test for None in paramtrized ids list --- testing/python/metafunc.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/testing/python/metafunc.py b/testing/python/metafunc.py index 75bd350c3..0b719d183 100644 --- a/testing/python/metafunc.py +++ b/testing/python/metafunc.py @@ -796,6 +796,24 @@ class TestMetafuncFunctional: *test_function*1.3-b1* """) + def test_parametrize_with_None_in_ids(self, testdir): + testdir.makepyfile(""" + import pytest + def pytest_generate_tests(metafunc): + metafunc.parametrize(("a", "b"), [(1,1), (1,1) , (1,2)], + ids=["basic", None, "advanced"]) + + def test_function(a, b): + assert a == b + """) + result = testdir.runpytest("-v") + assert result.ret == 1 + result.stdout.fnmatch_lines_random([ + "*test_function*basic*PASSED", + "*test_function*1-1*PASSED", + "*test_function*advanced*FAILED", + ]) + @pytest.mark.parametrize(("scope", "length"), [("module", 2), ("function", 4)]) def test_parametrize_scope_overrides(self, testdir, scope, length):