added a test for when the indirect is just a string
This commit is contained in:
parent
bbc7f3a631
commit
d000f2536a
|
@ -145,9 +145,7 @@ time or change existing behaviors in order to make them less surprising/more use
|
||||||
* Allow passing a custom debugger class (e.g. ``--pdbcls=IPython.core.debugger:Pdb``).
|
* Allow passing a custom debugger class (e.g. ``--pdbcls=IPython.core.debugger:Pdb``).
|
||||||
Thanks to `@anntzer`_ for the PR.
|
Thanks to `@anntzer`_ for the PR.
|
||||||
|
|
||||||
|
*
|
||||||
* Better message in case of not using parametrized variable (see `#1539`_).
|
|
||||||
Thanks to `@tramwaj29`_ for the PR.
|
|
||||||
|
|
||||||
*
|
*
|
||||||
|
|
||||||
|
@ -234,6 +232,9 @@ time or change existing behaviors in order to make them less surprising/more use
|
||||||
|
|
||||||
* ``optparse`` backward compatibility supports float/complex types (`#457`_).
|
* ``optparse`` backward compatibility supports float/complex types (`#457`_).
|
||||||
|
|
||||||
|
* Better message in case of not using parametrized variable (see `#1539`_).
|
||||||
|
Thanks to `@tramwaj29`_ for the PR.
|
||||||
|
|
||||||
*
|
*
|
||||||
|
|
||||||
*
|
*
|
||||||
|
|
|
@ -804,7 +804,7 @@ class Metafunc(fixtures.FuncargnamesCompatAttr):
|
||||||
if isinstance(indirect, (tuple, list)):
|
if isinstance(indirect, (tuple, list)):
|
||||||
name = 'fixture' if arg in indirect else 'argument'
|
name = 'fixture' if arg in indirect else 'argument'
|
||||||
else:
|
else:
|
||||||
name = 'fixture' if indirect is True else 'argument'
|
name = 'fixture' if indirect else 'argument'
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
"%r uses no %s %r" % (
|
"%r uses no %s %r" % (
|
||||||
self.function, name, arg))
|
self.function, name, arg))
|
||||||
|
|
|
@ -417,6 +417,23 @@ class TestMetafunc:
|
||||||
"*uses no fixture 'y'*",
|
"*uses no fixture 'y'*",
|
||||||
])
|
])
|
||||||
|
|
||||||
|
@pytest.mark.issue714
|
||||||
|
def test_parametrize_indirect_uses_no_fixture_error_indirect_string(self, testdir):
|
||||||
|
testdir.makepyfile("""
|
||||||
|
import pytest
|
||||||
|
@pytest.fixture(scope='function')
|
||||||
|
def x(request):
|
||||||
|
return request.param * 3
|
||||||
|
|
||||||
|
@pytest.mark.parametrize('x, y', [('a', 'b')], indirect='y')
|
||||||
|
def test_simple(x):
|
||||||
|
assert len(x) == 3
|
||||||
|
""")
|
||||||
|
result = testdir.runpytest("--collect-only")
|
||||||
|
result.stdout.fnmatch_lines([
|
||||||
|
"*uses no fixture 'y'*",
|
||||||
|
])
|
||||||
|
|
||||||
@pytest.mark.issue714
|
@pytest.mark.issue714
|
||||||
def test_parametrize_indirect_uses_no_fixture_error_indirect_list(self, testdir):
|
def test_parametrize_indirect_uses_no_fixture_error_indirect_list(self, testdir):
|
||||||
testdir.makepyfile("""
|
testdir.makepyfile("""
|
||||||
|
|
Loading…
Reference in New Issue