From f78d87ee3836dd0e6eae408c536f83a2b8ba6a3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Bedna=C5=99=C3=ADk?= Date: Sat, 25 Jul 2015 15:38:11 +0200 Subject: [PATCH 1/3] Issue #751 - test. --- testing/python/collect.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/testing/python/collect.py b/testing/python/collect.py index dc073b103..5bbff6a64 100644 --- a/testing/python/collect.py +++ b/testing/python/collect.py @@ -472,6 +472,24 @@ class TestFunction: config.pluginmanager.register(MyPlugin2()) config.hook.pytest_pyfunc_call(pyfuncitem=item) + def test_issue751_multiple_parametrize_with_ids(self, testdir): + modcol = testdir.getmodulecol(""" + import pytest + @pytest.mark.parametrize('x', [0], ids=['c']) + @pytest.mark.parametrize('y', [0, 1], ids=['a', 'b']) + class Test(object): + def test1(self, x, y): + pass + def test2(self, x, y): + pass + """) + colitems = modcol.collect()[0].collect()[0].collect() + assert colitems[0].name == 'test1[a-c]' + assert colitems[1].name == 'test1[b-c]' + assert colitems[2].name == 'test2[a-c]' + assert colitems[3].name == 'test2[b-c]' + + class TestSorting: def test_check_equality(self, testdir): modcol = testdir.getmodulecol(""" From 9906a19e295a7ce3710970e69a2b3b2f82b006b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Bedna=C5=99=C3=ADk?= Date: Sat, 25 Jul 2015 15:38:27 +0200 Subject: [PATCH 2/3] Issue #751 - fix. --- _pytest/mark.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_pytest/mark.py b/_pytest/mark.py index c3dc692f0..50581e0a8 100644 --- a/_pytest/mark.py +++ b/_pytest/mark.py @@ -291,7 +291,7 @@ class MarkInfo: #: positional argument list, empty if none specified self.args = args #: keyword argument dictionary, empty if nothing specified - self.kwargs = kwargs + self.kwargs = kwargs.copy() self._arglist = [(args, kwargs.copy())] def __repr__(self): From 0b9265049411ad4eead38c15557dcf7445188385 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Bedna=C5=99=C3=ADk?= Date: Sat, 25 Jul 2015 16:25:29 +0200 Subject: [PATCH 3/3] Update changelog. --- CHANGELOG | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 3bff6ee6f..5e7a1b051 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,10 @@ 2.8.0.dev (compared to 2.7.X) ----------------------------- +- fix issue751: multiple parametrize with ids bug if it parametrizes class with + two or more test methods. Thanks Sergey Chipiga for reporting and Jan + Bednarik for PR. + - fix issue768: docstrings found in python modules were not setting up session fixtures. Thanks Jason R. Coombs for reporting and Bruno Oliveira for the PR.