Write failing test for parametrized tests with unmarshable parameters

Related to #1030; committing directly to pytest repository to
get feedback from others on how to proceed.
This commit is contained in:
Bruno Oliveira 2015-09-21 02:39:34 -03:00
parent 9d1ae0a149
commit 661495e5c5
1 changed files with 16 additions and 0 deletions

View File

@ -269,6 +269,22 @@ class TestLastFailed:
lastfailed = config.cache.get("cache/lastfailed", -1) lastfailed = config.cache.get("cache/lastfailed", -1)
assert not lastfailed assert not lastfailed
def test_non_serializable_parametrize(self, testdir):
"""Test that failed parametrized tests with unmarshable parameters
don't break pytest-cache.
"""
testdir.makepyfile(r"""
import pytest
@pytest.mark.parametrize('val', [
b'\xac\x10\x02G',
])
def test_fail(val):
assert False
""")
result = testdir.runpytest()
result.stdout.fnmatch_lines('*1 failed in*')
def test_lastfailed_collectfailure(self, testdir, monkeypatch): def test_lastfailed_collectfailure(self, testdir, monkeypatch):
testdir.makepyfile(test_maybe=""" testdir.makepyfile(test_maybe="""