Merge pull request #6607 from asottile/empty_string_parametrize_nodeid
Fix node ids which contain a parametrized empty-string variable
This commit is contained in:
commit
595d62bc3e
|
@ -0,0 +1 @@
|
|||
Fix node ids which contain a parametrized empty-string variable.
|
|
@ -873,7 +873,7 @@ class CallSpec2:
|
|||
|
||||
@property
|
||||
def id(self):
|
||||
return "-".join(map(str, filter(None, self._idlist)))
|
||||
return "-".join(map(str, self._idlist))
|
||||
|
||||
def setmulti2(self, valtypes, argnames, valset, id, marks, scopenum, param_index):
|
||||
for arg, val in zip(argnames, valset):
|
||||
|
|
|
@ -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(
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue