From 661495e5c58996ab6ae3a5353cae3b95dbfa1965 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Mon, 21 Sep 2015 02:39:34 -0300 Subject: [PATCH] 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. --- testing/test_cache.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/testing/test_cache.py b/testing/test_cache.py index 0538be9d7..20a6cf78a 100755 --- a/testing/test_cache.py +++ b/testing/test_cache.py @@ -269,6 +269,22 @@ class TestLastFailed: lastfailed = config.cache.get("cache/lastfailed", -1) 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): testdir.makepyfile(test_maybe="""