Fix internal error when parametrizing using and empty list of ids()

Fix #1849
This commit is contained in:
Bruno Oliveira
2016-08-23 18:14:15 -03:00
parent 7538680c98
commit df200297e2
3 changed files with 33 additions and 2 deletions

View File

@@ -889,6 +889,33 @@ class TestMetafuncFunctional:
"*test_function*advanced*FAILED",
])
def test_fixture_parametrized_empty_ids(self, testdir):
"""Fixtures parametrized with empty ids cause an internal error (#1849)."""
testdir.makepyfile('''
import pytest
@pytest.fixture(scope="module", ids=[], params=[])
def temp(request):
return request.param
def test_temp(temp):
pass
''')
result = testdir.runpytest()
result.stdout.fnmatch_lines(['* 1 skipped *'])
def test_parametrized_empty_ids(self, testdir):
"""Tests parametrized with empty ids cause an internal error (#1849)."""
testdir.makepyfile('''
import pytest
@pytest.mark.parametrize('temp', [], ids=list())
def test_temp(temp):
pass
''')
result = testdir.runpytest()
result.stdout.fnmatch_lines(['* 1 skipped *'])
def test_parametrize_with_identical_ids_get_unique_names(self, testdir):
testdir.makepyfile("""
import pytest