Merge junit-xml url attribute branch
Merge branch 'url_attr' of https://github.com/fushi/pytest into junitxml-url
This commit is contained in:
commit
dc16fe2bb9
|
@ -1,7 +1,8 @@
|
||||||
3.1.0.dev
|
3.1.0.dev
|
||||||
=========
|
=========
|
||||||
|
|
||||||
*
|
* Testcase reports with a url attribute will now properly write this to junitxml.
|
||||||
|
Thanks `@fushi`_ for the PR
|
||||||
|
|
||||||
*
|
*
|
||||||
|
|
||||||
|
@ -11,6 +12,8 @@
|
||||||
|
|
||||||
*
|
*
|
||||||
|
|
||||||
|
.. _@fushi: https://github.com/fushi
|
||||||
|
|
||||||
|
|
||||||
3.0.2
|
3.0.2
|
||||||
=====
|
=====
|
||||||
|
@ -35,7 +38,7 @@
|
||||||
enabled. This allows proper post mortem debugging for all applications
|
enabled. This allows proper post mortem debugging for all applications
|
||||||
which have significant logic in their tearDown machinery (`#1890`_). Thanks
|
which have significant logic in their tearDown machinery (`#1890`_). Thanks
|
||||||
`@mbyt`_ for the PR.
|
`@mbyt`_ for the PR.
|
||||||
|
|
||||||
* Fix use of deprecated ``getfuncargvalue`` method in the internal doctest plugin.
|
* Fix use of deprecated ``getfuncargvalue`` method in the internal doctest plugin.
|
||||||
Thanks `@ViviCoder`_ for the report (`#1898`_).
|
Thanks `@ViviCoder`_ for the report (`#1898`_).
|
||||||
|
|
||||||
|
|
|
@ -102,6 +102,8 @@ class _NodeReporter(object):
|
||||||
}
|
}
|
||||||
if testreport.location[1] is not None:
|
if testreport.location[1] is not None:
|
||||||
attrs["line"] = testreport.location[1]
|
attrs["line"] = testreport.location[1]
|
||||||
|
if hasattr(testreport, "url"):
|
||||||
|
attrs["url"] = testreport.url
|
||||||
self.attrs = attrs
|
self.attrs = attrs
|
||||||
|
|
||||||
def to_xml(self):
|
def to_xml(self):
|
||||||
|
|
|
@ -922,3 +922,28 @@ def test_global_properties(testdir):
|
||||||
actual[k] = v
|
actual[k] = v
|
||||||
|
|
||||||
assert actual == expected
|
assert actual == expected
|
||||||
|
|
||||||
|
|
||||||
|
def test_url_property(testdir):
|
||||||
|
test_url = "http://www.github.com/pytest-dev"
|
||||||
|
path = testdir.tmpdir.join("test_url_property.xml")
|
||||||
|
log = LogXML(str(path), None)
|
||||||
|
from _pytest.runner import BaseReport
|
||||||
|
|
||||||
|
class Report(BaseReport):
|
||||||
|
longrepr = "FooBarBaz"
|
||||||
|
sections = []
|
||||||
|
nodeid = "something"
|
||||||
|
location = 'tests/filename.py', 42, 'TestClass.method'
|
||||||
|
url = test_url
|
||||||
|
|
||||||
|
test_report = Report()
|
||||||
|
|
||||||
|
log.pytest_sessionstart()
|
||||||
|
node_reporter = log._opentestcase(test_report)
|
||||||
|
node_reporter.append_failure(test_report)
|
||||||
|
log.pytest_sessionfinish()
|
||||||
|
|
||||||
|
test_case = minidom.parse(str(path)).getElementsByTagName('testcase')[0]
|
||||||
|
|
||||||
|
assert (test_case.getAttribute('url') == test_url), "The URL did not get written to the xml"
|
Loading…
Reference in New Issue