From 63bac67fb5bb016eac1d1cb000f242086d6aaf23 Mon Sep 17 00:00:00 2001 From: elizabeth Date: Sun, 2 Aug 2015 23:06:24 +0300 Subject: [PATCH] Add test for bad value in argument 'indirect' --- testing/python/metafunc.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/testing/python/metafunc.py b/testing/python/metafunc.py index d696af7c5..df07a96e2 100644 --- a/testing/python/metafunc.py +++ b/testing/python/metafunc.py @@ -261,6 +261,25 @@ class TestMetafunc: "*1 passed*", ]) + def test_parametrize_indirect_bad_arg(self, testdir): + testdir.makepyfile(""" + import pytest + @pytest.fixture(scope='function') + def x(request): + return request.param * 3 + @pytest.fixture(scope='function') + def y(request): + return request.param * 2 + @pytest.mark.parametrize('x, y', [('a', 'b')], indirect=['x', 'z']) + def test_simple(x,y): + assert len(x) == 3 + assert len(y) == 1 + """) + result = testdir.runpytest("-v") + result.stdout.fnmatch_lines([ + "*indirect: fixture 'z' doesn't exist*", + ]) + def test_addcalls_and_parametrize_indirect(self): def func(x, y): pass metafunc = self.Metafunc(func)