testplan.exporters.testing.pdf.renderers package¶
Subpackages¶
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
- source (
-
-
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) tuple - width (
int
) – width allowed to layout each paragraph - height (
int
) – height allowed to layout each paragraph - style (ReportLab ParagraphStyle) – style object for paragraph
- parts ([(
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:
testplan.exporters.testing.pdf.renderers.reports.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.
TestCaseRowBuilder
(style)[source]¶ Bases:
testplan.exporters.testing.pdf.renderers.reports.TestRowRenderer
Row builder for TestCaseReport, this mainly corresponds to a testcase method / function.
-
class
testplan.exporters.testing.pdf.renderers.reports.
TestReportRenderer
(style)[source]¶ Bases:
testplan.exporters.testing.pdf.renderers.base.BaseRowRenderer
,testplan.exporters.testing.pdf.renderers.base.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: testplan.report.testing.base.TestReport, depth: int, row_idx: int, lvl: int = 40) → Optional[functools.partial(<class 'testplan.common.exporters.pdf.RowData'>, num_columns=4)][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: testplan.report.testing.base.TestReport) → collections.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:
testplan.exporters.testing.pdf.renderers.base.BaseRowRenderer
,testplan.exporters.testing.pdf.renderers.base.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_header_linestyle
() → Tuple[int, reportlab.lib.colors.HexColor][source]¶ Styling for the line below test header.
-
get_logs
(source: testplan.report.testing.base.TestGroupReport, depth: int, row_idx: int, lvl: int = 40) → Optional[functools.partial(<class 'testplan.common.exporters.pdf.RowData'>, num_columns=4)][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.
-