Fix node ids which contain a parametrized empty-string variable

This commit is contained in:
Anthony Sottile
2020-01-28 13:27:54 -08:00
parent e440b43258
commit abd5fc80e8
3 changed files with 15 additions and 1 deletions

View File

@@ -492,6 +492,19 @@ class TestFunction:
)
assert "foo" in keywords[1] and "bar" in keywords[1] and "baz" in keywords[1]
def test_parametrize_with_empty_string_arguments(self, testdir):
items = testdir.getitems(
"""\
import pytest
@pytest.mark.parametrize('v', ('', ' '))
@pytest.mark.parametrize('w', ('', ' '))
def test(v, w): ...
"""
)
names = {item.name for item in items}
assert names == {"test[-]", "test[ -]", "test[- ]", "test[ - ]"}
def test_function_equality_with_callspec(self, testdir):
items = testdir.getitems(
"""