flowbber.plugins.sources.pytest
¶This source parses the JUnit like results XML file generated by pytest.
Data collected:
{
"errors": 0,
"failures": 2,
"skips": 0,
"tests": 4,
"passed": 6,
"time": 0.047,
"suites": {
"<suite_name>": {
"errors": 0,
"failures": 2,
"skips": 0,
"tests": 4,
"time": 0.047,
"cases": {
"<classname>.<name>": {
"status": "<PASS|FAIL|ERROR|SKIP>",
"file": "test/test_file.py",
"line": 19,
"classname": "test.test_file",
"name": "test_function",
"time": 0.0012459754943847656,
"properties": [
{"<propname1>": "<propvalue1>"},
{"<propname2>": "<propvalue2>"}
]
}
}
}
}
}
Warning
Most of the time the <suite_name>
will be set to pytest
, but
do not hardwire your code to that value. It can be changed by changing your
pytest.ini
file:
In addition to the previous data structure, if status is FAIL
, ERROR
or SKIP
an additional key failure
, error
or skipped
will be
available with information of the problem:
{
# ...
'error': {
'code': (
'@pytest.fixture\n'
' def dofail():\n'
'> raise RuntimeError()\n'
'E RuntimeError\n\nconftest.py:14: RuntimeError'
),
'message': 'test setup failure',
}
}
The information object always have a message
and a code
key describing
what the issue is and where it happened.
Dependencies:
pip3 install flowbber[pytest]
Usage:
[[sources]]
type = "pytest"
id = "..."
[sources.config]
xmlpath = "tests.xml"
{
"sources": [
{
"type": "pytest",
"id": "...",
"config": {
"xmlpath": "tests.xml"
}
}
]
}
Path to the JUnit like XML results tests.xml
file to be parsed.
Default: N/A
Optional: False
Schema:
{
'type': 'string',
'empty': False,
}
Secret: False
PytestSource
:
Main base class to implement a Source.flowbber.plugins.sources.pytest.
PytestSource
(index, type_, id_, optional=False, timeout=None, config=None)¶Inheritance