testplan.exporters.testing.pdf package

Module contents

PDF Export logic for test reports via ReportLab.

class testplan.exporters.testing.pdf.BasePDFExporterConfig(**options)[source]

Bases: testplan.common.exporters.ExporterConfig

Config for PDF exporter

classmethod get_options()[source]

Override this classmethod to provide extra config arguments.

class testplan.exporters.testing.pdf.PDFExporter(name='PDF exporter', **options)[source]

Bases: testplan.common.exporters.BaseExporter

PDF Exporter.

Parameters:pdf_path (str) – File path for saving PDF report.

Also inherits all Exporter options.

CONFIG

alias of PDFExporterConfig

create_pdf(source)[source]

Entry point for PDF generation.

export(source: testplan.report.testing.base.TestReport, export_context: Optional[testplan.common.exporters.ExportContext] = None) → Optional[Dict[KT, VT]][source]

Exports report to PDF in the given directory.

Param:source: Testplan report to export
Param:export_context: information about other exporters
Returns:dictionary containing the possible output
class testplan.exporters.testing.pdf.PDFExporterConfig(**options)[source]

Bases: testplan.exporters.testing.pdf.BasePDFExporterConfig

Configuration object for PDFExporter object.

classmethod get_options()[source]

Override this classmethod to provide extra config arguments.

class testplan.exporters.testing.pdf.TagFilteredPDFExporter(name=None, **options)[source]

Bases: testplan.exporters.testing.tagfiltered.base.TagFilteredExporter

Tag filtered PDF Exporter.

Parameters:report_dir (str) – Directory for saving PDF reports.

Also inherits all TagFilteredExporter options.

CONFIG

alias of TagFilteredPDFExporterConfig

exporter_class

alias of PDFExporter

get_params(tag_dict, filter_type)[source]

Return the keyword parameters (as a dict) that will be used for exporter_class instance initialization. The keys and values should be valid arguments in line with exporter_class’s config.

Parameters:
  • tag_dict – tag context for the current sub-export operation
  • filter_type – all / any
Returns:

dictionary of keyword arguments

class testplan.exporters.testing.pdf.TagFilteredPDFExporterConfig(**options)[source]

Bases: testplan.exporters.testing.tagfiltered.base.TagFilteredExporterConfig, testplan.exporters.testing.pdf.BasePDFExporterConfig

Configuration object for TagFilteredPDFExporter # pylint: disable=line-too-long object.

classmethod get_options()[source]

Override this classmethod to provide extra config arguments.

testplan.exporters.testing.pdf.generate_path_for_tags(config, tag_dict, filter_type)[source]

Generate the PDF filename using the given filter and tag context. Will trim the filename and append a uuid suffix if it ends up being longer than MAX_FILENAME_LENGTH.

TOOD: support custom filename generation & move logic to the exporter.

>>> generate_pdf_path(
...   filter_type='all',
...   tag_arg_dict={
...     'simple': {'foo', 'bar'},
...     'hello': {'world', 'mars'}
...   }
... )

<directory>/report-tags-all-foo__bar__hello-world-mars.pdf