e3.testsuite.report.rewriting ============================= .. py:module:: e3.testsuite.report.rewriting .. autoapi-nested-parse:: Helpers to automatically rewrite test baseline. Exceptions ---------- .. autoapisummary:: e3.testsuite.report.rewriting.RewritingError Classes ------- .. autoapisummary:: e3.testsuite.report.rewriting.RewritingSummary e3.testsuite.report.rewriting.BaseBaselineRewriter Module Contents --------------- .. py:exception:: RewritingError Bases: :py:obj:`Exception` Raised by BaseBaselineRewriter.rewrite in case of fatal error. .. py:class:: RewritingSummary Summary of rewritten baselines. .. py:attribute:: errors :type: set[str] Set of test names whose result was an error (baseline not updated). .. py:attribute:: updated_baselines :type: 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. .. py:attribute:: new_baselines :type: set[str] Set of test names whose baseline was created. .. py:attribute:: deleted_baselines :type: set[str] Set of test names whose baseline file was removed. .. py:class:: BaseBaselineRewriter(colors: e3.testsuite.utils.ColorConfig, default_encoding: str = 'utf-8') Bases: :py:obj:`abc.ABC` Base class to rewrite test baselines from testsuite results. .. py:attribute:: colors .. py:attribute:: default_encoding :value: 'utf-8' .. py:method:: baseline_filename(test_name: str) -> str :abstractmethod: Return the filename that contains the baseline for the given test. :param test_name: Name of the test for which we want the baseline filename. .. py:method:: 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. .. py:method:: rewrite(results_dir: str) -> RewritingSummary Rewrite baselines from a testsuite report. :param 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. :return: A summary of tests that were processed. .. py:method:: rewrite_from_index(summary: RewritingSummary, index: e3.testsuite.report.index.ReportIndex) -> None Rewrite baselines from a native e3-testsuite report index. .. py:method:: rewrite_from_gaia(summary: RewritingSummary, results: list[str]) -> None Rewrite baselines from a GAIA report. .. py:method:: handle_test_error(summary: RewritingSummary, test_name: str, reason: str) -> None Notify users that a test result is an error. .. py:method:: handle_test_diff(summary: RewritingSummary, test_name: str, new_baseline: bytes | str, encoding: str) -> None Rewrite the baseline of a single test. .. py:method:: print_stderr(message: str, prefix: str, style: str = '') -> None .. py:method:: print_info(message: str) -> None .. py:method:: print_warning(message: str) -> None .. py:method:: print_error(message: str) -> None