{"action":"created","issue":{"url":"https://api.github.com/repos/pytest-dev/pytest-xdist/issues/130","repository_url":"https://api.github.com/repos/pytest-dev/pytest-xdist","labels_url":"https://api.github.com/repos/pytest-dev/pytest-xdist/issues/130/labels{/name}","comments_url":"https://api.github.com/repos/pytest-dev/pytest-xdist/issues/130/comments","events_url":"https://api.github.com/repos/pytest-dev/pytest-xdist/issues/130/events","html_url":"https://github.com/pytest-dev/pytest-xdist/issues/130","id":213195173,"number":130,"title":"Incorrect failure message attribute in junitxml file when combined with xdist","user":{"login":"timyhou","id":5649864,"avatar_url":"https://avatars0.githubusercontent.com/u/5649864?v=3","gravatar_id":"","url":"https://api.github.com/users/timyhou","html_url":"https://github.com/timyhou","followers_url":"https://api.github.com/users/timyhou/followers","following_url":"https://api.github.com/users/timyhou/following{/other_user}","gists_url":"https://api.github.com/users/timyhou/gists{/gist_id}","starred_url":"https://api.github.com/users/timyhou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timyhou/subscriptions","organizations_url":"https://api.github.com/users/timyhou/orgs","repos_url":"https://api.github.com/users/timyhou/repos","events_url":"https://api.github.com/users/timyhou/events{/privacy}","received_events_url":"https://api.github.com/users/timyhou/received_events","type":"User","site_admin":false},"labels":[{"id":255239944,"url":"https://api.github.com/repos/pytest-dev/pytest-xdist/labels/bug","name":"bug","color":"fc2929","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2017-03-09T23:11:18Z","updated_at":"2017-06-15T19:37:24Z","closed_at":null,"body":"When combining xdist with pytest's junitxml flag there is an issue where the generated report will have the incorrect <failure message=> attribute value. \r\n\r\ntest_case.py\r\n\r\n```python\r\nimport pytest\r\n\r\nclass TestxDistXmlIssue:\r\n    def test_one(self):\r\n        # stack trace code\r\n        # stack trace code\r\n        # stack trace code\r\n        # stack trace code\r\n        # stack trace code\r\n        assert 1 == 2, \"Only print this message\"\r\n\r\n    def test_two(self):\r\n        # stack trace code\r\n        # stack trace code\r\n        # stack trace code\r\n        # stack trace code\r\n        # stack trace code\r\n        assert False, \"Only print this message\"\r\n```\r\n\r\nRan with the following command\r\n\r\n```\r\npytest -n2 --junitxml=\"test_xdist.xml\" test_case.py\r\n```\r\n\r\ntest_xdist.xml \r\n\r\nNotice that the <failure message=> attribute is a duplication of the stack trace \r\n\r\n```xml\r\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<testsuite errors=\"0\" failures=\"2\" name=\"pytest\" skips=\"0\" tests=\"2\" time=\"0.283\">\r\n    <testcase classname=\"pytesting.test_case.TestxDistXmlIssue\" file=\"pytesting/test_case.py\" line=\"25\" name=\"test_two\" time=\"0.0014913082122802734\">\r\n        <failure message=\"self = &lt;test_case.TestxDistXmlIssue object at 0x7f3770d5fa90&gt;      def test_two(self):         # stack trace code         # stack trace code         # stack trace code         # stack trace code         # stack trace code &gt;       assert False, &quot;Only print this message&quot; E       AssertionError: Only print this message E       assert False  pytesting/test_case.py:32: AssertionError\">self = &lt;test_case.TestxDistXmlIssue object at 0x7f3770d5fa90&gt;\r\n\r\n    def test_two(self):\r\n        # stack trace code\r\n        # stack trace code\r\n        # stack trace code\r\n        # stack trace code\r\n        # stack trace code\r\n&gt;       assert False, &quot;Only print this message&quot;\r\nE       AssertionError: Only print this message\r\nE       assert False\r\n\r\npytesting/test_case.py:32: AssertionError</failure>\r\n    </testcase>\r\n    <testcase classname=\"pytesting.test_case.TestxDistXmlIssue\" file=\"pytesting/test_case.py\" line=\"17\" name=\"test_one\" time=\"0.0014431476593017578\">\r\n        <failure message=\"self = &lt;test_case.TestxDistXmlIssue object at 0x7fab8351fac8&gt;      def test_one(self):         # stack trace code         # stack trace code         # stack trace code         # stack trace code         # stack trace code &gt;       assert 1 == 2, &quot;Only print this message&quot; E       AssertionError: Only print this message E       assert 1 == 2  pytesting/test_case.py:24: AssertionError\">self = &lt;test_case.TestxDistXmlIssue object at 0x7fab8351fac8&gt;\r\n\r\n    def test_one(self):\r\n        # stack trace code\r\n        # stack trace code\r\n        # stack trace code\r\n        # stack trace code\r\n        # stack trace code\r\n&gt;       assert 1 == 2, &quot;Only print this message&quot;\r\nE       AssertionError: Only print this message\r\nE       assert 1 == 2\r\n\r\npytesting/test_case.py:24: AssertionError</failure>\r\n    </testcase>\r\n</testsuite>\r\n```\r\n\r\nIf we take off the -n2 flag to disable xdist we get the expected faliure message attribute in the report\r\n\r\ntest_no_xdist.xml\r\n\r\n```xml\r\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<testsuite errors=\"0\" failures=\"2\" name=\"pytest\" skips=\"0\" tests=\"2\" time=\"0.024\">\r\n    <testcase classname=\"pytesting.test_case.TestxDistXmlIssue\" file=\"pytesting/test_case.py\" line=\"17\" name=\"test_one\" time=\"0.0010428428649902344\">\r\n        <failure message=\"AssertionError: Only print this message assert 1 == 2\">self = &lt;test_case.TestxDistXmlIssue object at 0x7f63ae6656d8&gt;\r\n\r\n    def test_one(self):\r\n        # stack trace code\r\n        # stack trace code\r\n        # stack trace code\r\n        # stack trace code\r\n        # stack trace code\r\n&gt;       assert 1 == 2, &quot;Only print this message&quot;\r\nE       AssertionError: Only print this message\r\nE       assert 1 == 2\r\n\r\npytesting/test_case.py:24: AssertionError</failure>\r\n    </testcase>\r\n    <testcase classname=\"pytesting.test_case.TestxDistXmlIssue\" file=\"pytesting/test_case.py\" line=\"25\" name=\"test_two\" time=\"0.00023293495178222656\">\r\n        <failure message=\"AssertionError: Only print this message assert False\">self = &lt;test_case.TestxDistXmlIssue object at 0x7f63ae665358&gt;\r\n\r\n    def test_two(self):\r\n        # stack trace code\r\n        # stack trace code\r\n        # stack trace code\r\n        # stack trace code\r\n        # stack trace code\r\n&gt;       assert False, &quot;Only print this message&quot;\r\nE       AssertionError: Only print this message\r\nE       assert False\r\n\r\npytesting/test_case.py:32: AssertionError</failure>\r\n    </testcase>\r\n</testsuite>\r\n```\r\n\r\nI believe the culprit is related to append_failure (line 133) in junitxml.py. When xdist is active that message is not being set to the expected longrepr.reprcrash.message value.\r\n\r\nAdditional information\r\nubuntu 14.04 python 3.6.0\r\nPip list\r\napipkg (1.4)\r\nappdirs (1.4.3)\r\nexecnet (1.4.1)\r\npackaging (16.8)\r\npip (9.0.1)\r\npy (1.4.32)\r\npyparsing (2.2.0)\r\npytest (3.0.6)\r\npytest-xdist (1.15.0)\r\nsetuptools (34.3.1)\r\nsix (1.10.0)"},"comment":{"url":"https://api.github.com/repos/pytest-dev/pytest-xdist/issues/comments/308844861","html_url":"https://github.com/pytest-dev/pytest-xdist/issues/130#issuecomment-308844861","issue_url":"https://api.github.com/repos/pytest-dev/pytest-xdist/issues/130","id":308844861,"user":{"login":"RonnyPfannschmidt","id":156838,"avatar_url":"https://avatars2.githubusercontent.com/u/156838?v=3","gravatar_id":"","url":"https://api.github.com/users/RonnyPfannschmidt","html_url":"https://github.com/RonnyPfannschmidt","followers_url":"https://api.github.com/users/RonnyPfannschmidt/followers","following_url":"https://api.github.com/users/RonnyPfannschmidt/following{/other_user}","gists_url":"https://api.github.com/users/RonnyPfannschmidt/gists{/gist_id}","starred_url":"https://api.github.com/users/RonnyPfannschmidt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RonnyPfannschmidt/subscriptions","organizations_url":"https://api.github.com/users/RonnyPfannschmidt/orgs","repos_url":"https://api.github.com/users/RonnyPfannschmidt/repos","events_url":"https://api.github.com/users/RonnyPfannschmidt/events{/privacy}","received_events_url":"https://api.github.com/users/RonnyPfannschmidt/received_events","type":"User","site_admin":false},"created_at":"2017-06-15T19:37:24Z","updated_at":"2017-06-15T19:37:24Z","body":"please open a pull request, we are happy to help you bring your working experiment up to shape\r\n\r\n👍 "}}
{"actor":{"display_login":"RonnyPfannschmidt"}}