pytest_flakefighters.flakefighters.abstract_flakefighter

This module implements the FlakeFighter abstract class to be extended by concrete flakefighter classes. Each of these is a microservice which takes a failed test and classifies that failure as either genuine or flaky. This classification can be configured to either run “live” after each test, or as a postprocessing step on the entire test suite after it completes. If running live, detectors are run at the end of pytest_runtest_makereport. If running as a postprocessing step, detectors are run at the start of pytest_sessionfinish.

Module Contents

Classes

FlakeFighter

Abstract base class for a FlakeFighter

class pytest_flakefighters.flakefighters.abstract_flakefighter.FlakeFighter(run_live: bool)

Bases: abc.ABC

Abstract base class for a FlakeFighter :ivar run_live: Run detection “live” after each test. Otherwise run as a postprocessing step after the test suite.

abstract classmethod from_config(config: dict)

Factory method to create a new instance from a pytest configuration.

abstract flaky_test_live(execution: pytest_flakefighters.database_management.TestExecution)

Detect whether a given test execution is flaky and append the result to its flakefighter_results attribute. :param execution: The test execution to classify.

abstract flaky_tests_post(run: pytest_flakefighters.database_management.Run)

Go through each test in the test suite and append the result to its flakefighter_results attribute. :param run: Run object representing the pytest run, with tests accessible through run.tests.

abstract params() dict

Convert the key parameters into a dictionary so that the object can be replicated. :return A dictionary of the parameters used to create the object.