testplan.exporters.testing.pdf.renderers package
Subpackages
- testplan.exporters.testing.pdf.renderers.entries package
- Submodules
- testplan.exporters.testing.pdf.renderers.entries.assertions module
ApproximateEqualityAssertionRenderer
AssertionRenderer
ColumnContainRenderer
DictCheckRenderer
DictMatchAllRenderer
DictMatchRenderer
EqualExcludeSlicesRenderer
EqualSlicesRenderer
ExceptionRaisedRenderer
FunctionAssertionRenderer
LineDiffRenderer
LogfileMatchRender
MembershipRenderer
RawAssertionRenderer
RegexFindIterRenderer
RegexMatchLineRenderer
RegexMatchRenderer
RegexNotMatchRenderer
TableMatchRenderer
XMLCheckRenderer
append_comparison_data()
default_assertion_style()
- testplan.exporters.testing.pdf.renderers.entries.base module
- testplan.exporters.testing.pdf.renderers.entries.baseUtils module
- testplan.exporters.testing.pdf.renderers.entries.assertions module
- Module contents
- Submodules
Submodules
testplan.exporters.testing.pdf.renderers.base module
Base classes for rendering.
- class testplan.exporters.testing.pdf.renderers.base.BaseRowRenderer(style)[source]
Bases:
object
Base class for row renderers.
- always_display = False
- get_row_data(source, depth, row_idx)[source]
Return RowData to be rendered on the pdf.
- Parameters:
source (
report.base.Report
ordict
(for assertion data).) – Source object for the renderer.depth (
int
) – Depth of the source object on report tree. Used for indentation.row_idx (
int
) – Index of the current table row to be rendered.
- Returns:
RowData
object.- Return type:
exporters.utils.pdf.RowData
- class testplan.exporters.testing.pdf.renderers.base.MetadataMixin[source]
Bases:
object
Utility mixin that has logic for getting metadata context for row renderers.
Basically we’d like to selectively render the information stored in meta dictionary, with readable labels.
- get_metadata_context(source)[source]
Return metadata context to be rendered on the PDF with readable labels.
- metadata_labels = ()
- class testplan.exporters.testing.pdf.renderers.base.SlicedParagraph(parts, width, height=1132.204724409449, style=<ParagraphStyle 'default'>, **kwargs)[source]
Bases:
object
Iterator which returns slices of ReportLab Paragraph to make sure each does not exceed max height (which will trigger ReportLab LayoutError).
- Parameters:
parts ([(
str
,str
), …]) – list of (text, formatter) tuplewidth (
int
) – width allowed to layout each paragraphheight (
int
) – height allowed to layout each paragraphstyle (ReportLab ParagraphStyle) – style object for paragraph
testplan.exporters.testing.pdf.renderers.constants module
TODO
testplan.exporters.testing.pdf.renderers.reports module
PDF Renderer classes for test report objects.
- class testplan.exporters.testing.pdf.renderers.reports.MultiTestRowBuilder(style)[source]
Bases:
TestRowRenderer
Multitests get special treatment with extra formatting & summary.
- get_header(source: ~testplan.report.testing.base.TestGroupReport, depth: int, row_idx: int) -> functools.partial(<class 'testplan.common.exporters.pdf.RowData'>, num_columns=4)[source]
Display short summary & run times along with pass/fail status.
- Parameters:
source – Source object for the renderer.
depth – Depth of the source object on report tree. Used for indentation.
row_idx – Index of the current table row to be rendered.
- class testplan.exporters.testing.pdf.renderers.reports.ReportRendererRegistry[source]
Bases:
Registry
- class testplan.exporters.testing.pdf.renderers.reports.TestCaseRowBuilder(style)[source]
Bases:
TestRowRenderer
Row builder for TestCaseReport, this mainly corresponds to a testcase method / function.
- get_header_linestyle() Tuple[int, HexColor] [source]
Testcase line separators are a little bit thinner, as there are many testcases per test run.
- should_display(source: TestCaseReport) bool [source]
Filter out passing rows if failing_tests is True.
- Parameters:
source – Source object for the renderer.
- class testplan.exporters.testing.pdf.renderers.reports.TestReportRenderer(style)[source]
Bases:
BaseRowRenderer
,MetadataMixin
Renders the rows for the root node:
report.testing.TestReport
.- always_display = True
- datetime_fmt = '%Y-%m-%d %H:%M:%S %Z'
- get_logs(source: TestReport, depth: int, row_idx: int, lvl: int = 40) functools.partial(<class 'testplan.common.exporters.pdf.RowData'>, num_columns=4) | None [source]
Get logs created by the report.logger object. Only select the logs with severity level equal to or higher than lvl.
- Parameters:
source – Source object for the renderer. Report for a Testplan test run.
depth – Depth of the source object on report tree. Used for indentation.
row_idx – Index of the current table row to be rendered.
lvl – Log severity level.
- get_metadata_context(source: TestReport) OrderedDict [source]
Enriched meta context with test counts, run times etc.
- Parameters:
source – Source object for the renderer. Report for a Testplan test run.
- get_row_data(source: ~testplan.report.testing.base.TestReport, depth: int, row_idx: int) -> functools.partial(<class 'testplan.common.exporters.pdf.RowData'>, num_columns=4)[source]
Render Testplan header & metadata
- Parameters:
source – Source object for the renderer. Report for a Testplan test run.
depth – Depth of the source object on report tree. Used for indentation.
row_idx – Index of the current table row to be rendered.
- metadata_labels = (('user', 'User'), ('project', 'Project'), ('git_url', 'Git URL'), ('git_commit', 'Git commit'), ('hostname', 'Host'), ('command_line_string', 'Command line string'), ('python_version', 'Python version'), ('report_tags_all', 'Report tags (all)'), ('report_tags_any', 'Report tags (any)'))
- class testplan.exporters.testing.pdf.renderers.reports.TestRowRenderer(style)[source]
Bases:
BaseRowRenderer
,MetadataMixin
Common logic for rendering test report objects.
- get_description(description: str, depth: int, row_idx: int) -> functools.partial(<class 'testplan.common.exporters.pdf.RowData'>, num_columns=4)[source]
Description for a test object, this will generally be docstring text.
- Parameters:
description – Description for a test object. Report for a Testplan test run.
depth – Depth of the source object on report tree. Used for indentation.
row_idx – Index of the current table row to be rendered.
- get_header(source: ~testplan.report.testing.base.TestGroupReport, depth: int, row_idx: int) -> functools.partial(<class 'testplan.common.exporters.pdf.RowData'>, num_columns=4)[source]
Assuming we have 4 columns per row, render the header in the format:
[<TEST_NAME> - <NATIVE TAGS>][][][<TEST_STATUS>]
This method is also used by its subclass, where source will be of type
TestCaseReport
.- Parameters:
source – Source object for the renderer.
depth – Depth of the source object on report tree. Used for indentation.
row_idx – Index of the current table row to be rendered.
- get_logs(source: TestGroupReport, depth: int, row_idx: int, lvl: int = 40) functools.partial(<class 'testplan.common.exporters.pdf.RowData'>, num_columns=4) | None [source]
Get logs created by the report.logger object. Only select the logs with severity level equal to or higher than lvl.
- Parameters:
source – Source object for the renderer.
depth – Depth of the source object on report tree. Used for indentation.
row_idx – Index of the current table row to be rendered.
lvl – Log severity level.
- get_row_data(source: ~testplan.report.testing.base.TestGroupReport, depth: int, row_idx: int) -> functools.partial(<class 'testplan.common.exporters.pdf.RowData'>, num_columns=4)[source]
Display test name/description, passed status & logs (if enabled).
- Parameters:
source – Source object for the renderer. Report for a Testplan test run.
depth – Depth of the source object on report tree. Used for indentation.
row_idx – Index of the current table row to be rendered.
- should_display(source: TestGroupReport) bool [source]
Filter out passing rows if failing_tests is True.
- Parameters:
source – Source object for the renderer.