File tree Expand file tree Collapse file tree 3 files changed +32
-2
lines changed Expand file tree Collapse file tree 3 files changed +32
-2
lines changed Original file line number Diff line number Diff line change 113.1.0.dev
22=========
33
4- *
4+ * Testcase reports with a url attribute will now properly write this to junitxml.
5+ Thanks `@fushi `_ for the PR
56
67*
78
1112
1213*
1314
15+ .. _@fushi : https://github.com/fushi
16+
1417
15183.0.2
1619=====
3538 enabled. This allows proper post mortem debugging for all applications
3639 which have significant logic in their tearDown machinery (`#1890 `_). Thanks
3740 `@mbyt `_ for the PR.
38-
41+
3942* Fix use of deprecated ``getfuncargvalue `` method in the internal doctest plugin.
4043 Thanks `@ViviCoder `_ for the report (`#1898 `_).
4144
Original file line number Diff line number Diff line change @@ -102,6 +102,8 @@ def record_testreport(self, testreport):
102102 }
103103 if testreport .location [1 ] is not None :
104104 attrs ["line" ] = testreport .location [1 ]
105+ if hasattr (testreport , "url" ):
106+ attrs ["url" ] = testreport .url
105107 self .attrs = attrs
106108
107109 def to_xml (self ):
Original file line number Diff line number Diff line change @@ -922,3 +922,28 @@ class Report(BaseReport):
922922 actual [k ] = v
923923
924924 assert actual == expected
925+
926+
927+ def test_url_property (testdir ):
928+ test_url = "http://www.github.com/pytest-dev"
929+ path = testdir .tmpdir .join ("test_url_property.xml" )
930+ log = LogXML (str (path ), None )
931+ from _pytest .runner import BaseReport
932+
933+ class Report (BaseReport ):
934+ longrepr = "FooBarBaz"
935+ sections = []
936+ nodeid = "something"
937+ location = 'tests/filename.py' , 42 , 'TestClass.method'
938+ url = test_url
939+
940+ test_report = Report ()
941+
942+ log .pytest_sessionstart ()
943+ node_reporter = log ._opentestcase (test_report )
944+ node_reporter .append_failure (test_report )
945+ log .pytest_sessionfinish ()
946+
947+ test_case = minidom .parse (str (path )).getElementsByTagName ('testcase' )[0 ]
948+
949+ assert (test_case .getAttribute ('url' ) == test_url ), "The URL did not get written to the xml"
You can’t perform that action at this time.
0 commit comments