pytest_output.output
Intermediary output format.
Classes
|
Test outcome. |
|
Intermediary output format. |
|
Pytest item intermediary data. |
|
Pytest item location. |
|
Test result. |
Output generator abstract class. |
- class pytest_output.output.Outcome(value)
Bases:
Enum
Test outcome.
- PASSED = 1
- FAILED = 2
- SKIPPED = 3
- ERROR = 4
- class pytest_output.output.OutputData(mode: Literal['run', 'collect'])
Bases:
object
Intermediary output format.
Contains various information about test case and run.
- Parameters:
mode (OutputModeType) – Pytest mode (collect or run)
- mode: Literal['run', 'collect']
Pytest mode (collect or run)
- items: OrderedDict[str, OutputDataItem]
Collected items.
- add_item(item: Item) OutputDataItem
Add new item to the collection.
- Parameters:
item (pytest.Item) – Pytest item (
pytest.Function
is expected).- Raises:
ValueError – If unexpected type is given.
- Returns:
Item’s intermediary output data.
- Return type:
- get_item(item: Item) OutputDataItem
Get item’s intermediary output data.
- Parameters:
item (pytest.Item) – ytest item (
pytest.Function
is expected).- Raises:
ValueError – If unexpected type is given.
- Returns:
Item’s intermediary output data.
- Return type:
- to_dict() dict[str, Any]
Transform this class into a dictionary.
- Returns:
Representation of this class as a dictionary.
- Return type:
dict[str, Any]
- class pytest_output.output.OutputDataItem(item: Function)
Bases:
object
Pytest item intermediary data.
- item: Function
Pytest item.
- id: str
Item id.
- name: str
Item name.
- description: str
Item description for docstring.
- package: str | None
Python package that contains this item.
- module: str
Python module that contains this item.
- cls: str | None
Python class that contains this item.
- location: OutputDataItemLocation
Item location.
- docstring: list[str]
List of item’s docstring (module, class, function).
- meta: dict[str, str]
Item meta data (
:name: value
strings in docstrings)
- markers: list[_pytest.mark.structures.Mark]
Markers associated with this item.
- result: OutputDataItemResult | None
Item test result.
- extra: dict[str, dict[str, str]]
Extra information provided from other plugins.
- to_dict() dict[str, Any]
Transform this class into a dictionary.
- Returns:
Representation of this class as a dictionary.
- Return type:
dict[str, Any]
- class pytest_output.output.OutputDataItemResult(result: TestReport)
Bases:
object
Test result.
- stdout: str
Captured standard output.
- stderr: str
Captured standard error output.
- logs: str
Captured logs.
- duration: float
Test run duration.
- summary: str
Test run short summary (e.g. reason for failure or skip).
- message: str
Test run long message (e.g. reason for failure or skip).
- to_dict() dict[str, Any]
Transform this class into a dictionary.
- Returns:
Representation of this class as a dictionary.
- Return type:
dict[str, Any]
- class pytest_output.output.OutputDataItemLocation(file: str, line: int | None, name: str)
Bases:
object
Pytest item location.
- file: str
File.
- line: int | None
Line.
- name: str
Name.
- to_dict() dict[str, Any]
Transform this class into a dictionary.
- Returns:
Representation of this class as a dictionary.
- Return type:
dict[str, Any]
- class pytest_output.output.OutputGenerator
Bases:
ABC
Output generator abstract class.
Inherit from this class to create a new generator.
- pytest_addoption(parser: Parser)
Add additional pytest command line options.
- Parameters:
parser (pytest.Parser) – Parser object.
- pytest_configure(config: Config)
Configure the generator object.
It is possible to read parsed command line option in this method.
- Parameters:
config (pytest.Config) – Pytest config.
- abstract generate(data: OutputData) None
Generate pytest output from intermediary data format.
- Parameters:
data (OutputData) – Gathered test cases and results.