From 63a924b922eb7387f52491c182149188456eba4f Mon Sep 17 00:00:00 2001 From: Anatoly Bubenkov Date: Sat, 7 Sep 2013 02:30:09 +0200 Subject: [PATCH 2/2] parametrize fails when values are unhashable - tests --HG-- branch : parametrize-fails-when-values-are --- testing/python/collect.py | 18 ++++++++++++++++++ testing/test_parametrize_with_fixture.py | 1 - 2 files changed, 18 insertions(+), 1 deletion(-) delete mode 100644 testing/test_parametrize_with_fixture.py diff --git a/testing/python/collect.py b/testing/python/collect.py index 2e9e78293..894eb6a91 100644 --- a/testing/python/collect.py +++ b/testing/python/collect.py @@ -329,6 +329,24 @@ class TestFunction: reprec = testdir.inline_run() reprec.assertoutcome(passed=1) + def test_parametrize_with_non_hashable_values(self, testdir): + """Test parametrization with non-hashable values.""" + testdir.makepyfile(""" + archival_mapping = { + '1.0': {'tag': '1.0'}, + '1.2.2a1': {'tag': 'release-1.2.2a1'}, + } + + import pytest + @pytest.mark.parametrize('key value'.split(), + archival_mapping.items()) + def test_archival_to_version(key, value): + assert key in archival_mapping + assert value == archival_mapping[key] + """) + rec = testdir.inline_run() + rec.assertoutcome(passed=2) + def test_function_equality_with_callspec(self, testdir, tmpdir): items = testdir.getitems(""" import pytest diff --git a/testing/test_parametrize_with_fixture.py b/testing/test_parametrize_with_fixture.py deleted file mode 100644 index 5871ed8ee..000000000 --- a/testing/test_parametrize_with_fixture.py +++ /dev/null @@ -1 +0,0 @@ -import pytest