From db9809d6dc7a3f0d8a78825c84c19303c6b8bda6 Mon Sep 17 00:00:00 2001 From: elizabeth Date: Sun, 2 Aug 2015 23:53:44 +0300 Subject: [PATCH] Update test for error in 'indirect' parameter --- testing/python/metafunc.py | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/testing/python/metafunc.py b/testing/python/metafunc.py index df07a96e2..366f2c067 100644 --- a/testing/python/metafunc.py +++ b/testing/python/metafunc.py @@ -261,24 +261,11 @@ 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_parametrize_indirect_list_error(self, testdir): + def func(x, y): pass + metafunc = self.Metafunc(func) + pytest.raises(ValueError, lambda: + metafunc.parametrize('x, y', [('a', 'b')], indirect=['x', 'z'])) def test_addcalls_and_parametrize_indirect(self): def func(x, y): pass