e3.testsuite.report.rewriting

Helpers to automatically rewrite test baseline.

Exceptions

RewritingError

Raised by BaseBaselineRewriter.rewrite in case of fatal error.

Classes

RewritingSummary

Summary of rewritten baselines.

BaseBaselineRewriter

Base class to rewrite test baselines from testsuite results.

Module Contents

exception e3.testsuite.report.rewriting.RewritingError

Bases: Exception

Raised by BaseBaselineRewriter.rewrite in case of fatal error.

class e3.testsuite.report.rewriting.RewritingSummary

Summary of rewritten baselines.

errors: set[str]

Set of test names whose result was an error (baseline not updated).

updated_baselines: set[str]

Set of baselines that were updated.

These are the baselines that changed, but that were not created nor deleted: they existed before the rewriting, they exist after and their contents are different.

new_baselines: set[str]

Set of test names whose baseline was created.

deleted_baselines: set[str]

Set of test names whose baseline file was removed.

class e3.testsuite.report.rewriting.BaseBaselineRewriter(colors: e3.testsuite.utils.ColorConfig, default_encoding: str = 'utf-8')

Bases: abc.ABC

Base class to rewrite test baselines from testsuite results.

colors
default_encoding = 'utf-8'
abstractmethod baseline_filename(test_name: str) str

Return the filename that contains the baseline for the given test.

Parameters:

test_name – Name of the test for which we want the baseline filename.

postprocess_baseline(baseline: bytes) bytes

Refine a baseline to rewrite.

By default, this returns the argument unchanged. Subclasses can override this if they need to refine baselines.

rewrite(results_dir: str) RewritingSummary

Rewrite baselines from a testsuite report.

Parameters:

results_dir – Name of the directory in which to read the test results used to update baselines. That directory can contain either a native e3-testsuite report index, or a GAIA report.

Returns:

A summary of tests that were processed.

rewrite_from_index(summary: RewritingSummary, index: e3.testsuite.report.index.ReportIndex) None

Rewrite baselines from a native e3-testsuite report index.

rewrite_from_gaia(summary: RewritingSummary, results: list[str]) None

Rewrite baselines from a GAIA report.

handle_test_error(summary: RewritingSummary, test_name: str, reason: str) None

Notify users that a test result is an error.

handle_test_diff(summary: RewritingSummary, test_name: str, new_baseline: bytes | str, encoding: str) None

Rewrite the baseline of a single test.

print_stderr(message: str, prefix: str, style: str = '') None
print_info(message: str) None
print_warning(message: str) None
print_error(message: str) None