pytest_flakefighters.function_coverage

This module implements the Profiler class to help measure function-level coverage.

Module Contents

Classes

Profiler

Provides functionality to measure function-level coverage of a pytest test suite.

class pytest_flakefighters.function_coverage.Profiler

Provides functionality to measure function-level coverage of a pytest test suite.

Variables:
  • coverage_data – The (potentially) covered lines for each module.

  • function_defs – The lines that define a given function in a given module, accessed as function_defs[module][function].

update_function_defs(module: str)

Extract the start and end lines for defined functions in the given module and add them to function_defs.

Parameters:

module – The filepath of the module to process.

start()

Start measuring coverage.

stop()

Stop measuring coverage.

switch_context(context: str)

Set the context name of the coverage measurement.

Parameters:

context – The context name to set.

get_data() coverage.CoverageData

Return coverage data.