From 3d2b7aeea55a62e4f177b80f03681260b8716c21 Mon Sep 17 00:00:00 2001 From: TomV Date: Thu, 3 Mar 2016 09:12:56 +0000 Subject: [PATCH] issue469: junit parsing nodeid, add method test --- CHANGELOG.rst | 9 ++++++--- testing/test_junitxml.py | 20 ++++++++++++++++++-- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index ccbbe2a79..625c7edc5 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,11 +5,15 @@ * -* Fix (`#469`_): junit parses report.nodeid incorrectly, when params contain - ``::``. +* Fix (`#469`_): junit parses report.nodeid incorrectly, when params IDs + contain ``::``. Thanks `@tomviner`_ for the PR (`#1431`_). * +.. _#469: https://github.com/pytest-dev/pytest/issues/469 +.. _#1431: https://github.com/pytest-dev/pytest/pull/1431 + + 2.9.0 ===== @@ -103,7 +107,6 @@ .. _`traceback style docs`: https://pytest.org/latest/usage.html#modifying-python-traceback-printing -.. _#469: https://github.com/pytest-dev/pytest/issues/469 .. _#1422: https://github.com/pytest-dev/pytest/issues/1422 .. _#1379: https://github.com/pytest-dev/pytest/issues/1379 .. _#1366: https://github.com/pytest-dev/pytest/issues/1366 diff --git a/testing/test_junitxml.py b/testing/test_junitxml.py index 7506efeea..5960f8825 100644 --- a/testing/test_junitxml.py +++ b/testing/test_junitxml.py @@ -620,7 +620,7 @@ def test_escaped_parametrized_names_xml(testdir): node.assert_attr(name="test_func[#x00]") -def test_double_colon_split_issue469(testdir): +def test_double_colon_split_function_issue469(testdir): testdir.makepyfile(""" import pytest @pytest.mark.parametrize('param', ["double::colon"]) @@ -630,7 +630,23 @@ def test_double_colon_split_issue469(testdir): result, dom = runandparse(testdir) assert result.ret == 0 node = dom.find_first_by_tag("testcase") - node.assert_attr(classname="test_double_colon_split_issue469") + node.assert_attr(classname="test_double_colon_split_function_issue469") + node.assert_attr(name='test_func[double::colon]') + + +def test_double_colon_split_method_issue469(testdir): + testdir.makepyfile(""" + import pytest + class TestClass: + @pytest.mark.parametrize('param', ["double::colon"]) + def test_func(self, param): + pass + """) + result, dom = runandparse(testdir) + assert result.ret == 0 + node = dom.find_first_by_tag("testcase") + node.assert_attr( + classname="test_double_colon_split_method_issue469.TestClass") node.assert_attr(name='test_func[double::colon]')