updates for PR review #2198
This commit is contained in:
parent
c848d0a771
commit
0e58c3fa80
|
@ -44,6 +44,10 @@ Changes
|
||||||
* fix `#2208`_: ensure a iteration limit for _pytest.compat.get_real_func.
|
* fix `#2208`_: ensure a iteration limit for _pytest.compat.get_real_func.
|
||||||
Thanks `@RonnyPfannschmidt`_ for the Report and PR
|
Thanks `@RonnyPfannschmidt`_ for the Report and PR
|
||||||
|
|
||||||
|
* Modify ``pytest_make_parametrize_id()`` hook to accept ``argname`` as an
|
||||||
|
additional parameter.
|
||||||
|
Thanks `@unsignedint`_ for the PR.
|
||||||
|
|
||||||
|
|
||||||
.. _@davidszotten: https://github.com/davidszotten
|
.. _@davidszotten: https://github.com/davidszotten
|
||||||
.. _@fushi: https://github.com/fushi
|
.. _@fushi: https://github.com/fushi
|
||||||
|
@ -52,6 +56,7 @@ Changes
|
||||||
.. _@fogo: https://github.com/fogo
|
.. _@fogo: https://github.com/fogo
|
||||||
.. _@lesteve: https://github.com/lesteve
|
.. _@lesteve: https://github.com/lesteve
|
||||||
.. _@mandeep: https://github.com/mandeep
|
.. _@mandeep: https://github.com/mandeep
|
||||||
|
.. _@unsignedint: https://github.com/unsignedint
|
||||||
|
|
||||||
.. _#1512: https://github.com/pytest-dev/pytest/issues/1512
|
.. _#1512: https://github.com/pytest-dev/pytest/issues/1512
|
||||||
.. _#1874: https://github.com/pytest-dev/pytest/pull/1874
|
.. _#1874: https://github.com/pytest-dev/pytest/pull/1874
|
||||||
|
@ -79,15 +84,10 @@ Changes
|
||||||
subdirectories with ini configuration files now uses the correct ini file
|
subdirectories with ini configuration files now uses the correct ini file
|
||||||
(`#2148`_). Thanks `@pelme`_.
|
(`#2148`_). Thanks `@pelme`_.
|
||||||
|
|
||||||
* Modify ``pytest_make_parametrize_id()`` hook to accept ``argname`` as an
|
|
||||||
additional parameter.
|
|
||||||
Thanks `@unsignedint`_ for the PR.
|
|
||||||
|
|
||||||
*
|
*
|
||||||
|
|
||||||
.. _@malinoff: https://github.com/malinoff
|
.. _@malinoff: https://github.com/malinoff
|
||||||
.. _@pelme: https://github.com/pelme
|
.. _@pelme: https://github.com/pelme
|
||||||
.. _@unsignedint: https://github.com/unsignedint
|
|
||||||
|
|
||||||
.. _#2129: https://github.com/pytest-dev/pytest/issues/2129
|
.. _#2129: https://github.com/pytest-dev/pytest/issues/2129
|
||||||
.. _#2148: https://github.com/pytest-dev/pytest/issues/2148
|
.. _#2148: https://github.com/pytest-dev/pytest/issues/2148
|
||||||
|
|
|
@ -157,7 +157,7 @@ def pytest_generate_tests(metafunc):
|
||||||
""" generate (multiple) parametrized calls to a test function."""
|
""" generate (multiple) parametrized calls to a test function."""
|
||||||
|
|
||||||
@hookspec(firstresult=True)
|
@hookspec(firstresult=True)
|
||||||
def pytest_make_parametrize_id(config, val, argname=None):
|
def pytest_make_parametrize_id(config, val, argname):
|
||||||
"""Return a user-friendly string representation of the given ``val`` that will be used
|
"""Return a user-friendly string representation of the given ``val`` that will be used
|
||||||
by @pytest.mark.parametrize calls. Return None if the hook doesn't know about ``val``.
|
by @pytest.mark.parametrize calls. Return None if the hook doesn't know about ``val``.
|
||||||
The parameter name is available as ``argname``, if required.
|
The parameter name is available as ``argname``, if required.
|
||||||
|
|
|
@ -1465,16 +1465,16 @@ class TestMarkersWithParametrization:
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
@pytest.mark.parametrize("x", range(2))
|
@pytest.mark.parametrize("x", range(2))
|
||||||
def test_func(x):
|
def test_func_a(x):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@pytest.mark.parametrize("y", [1])
|
@pytest.mark.parametrize("y", [1])
|
||||||
def test_func2(y):
|
def test_func_b(y):
|
||||||
pass
|
pass
|
||||||
""")
|
""")
|
||||||
result = testdir.runpytest("-v")
|
result = testdir.runpytest("-v")
|
||||||
result.stdout.fnmatch_lines([
|
result.stdout.fnmatch_lines([
|
||||||
"*test_func*0*PASS*",
|
"*test_func_a*0*PASS*",
|
||||||
"*test_func*2*PASS*",
|
"*test_func_a*2*PASS*",
|
||||||
"*test_func2*10*PASS*",
|
"*test_func_b*10*PASS*",
|
||||||
])
|
])
|
||||||
|
|
Loading…
Reference in New Issue