katgpucbf.pytest_plugins.reporter module
Mechanism for logging Pytest’s output to a PDF.
The immediate output is not actually a PDF. Instead, custom JSON-compatible
data structures are stored in the log output. These are post-processed by
report/generate_pdf.py to produce a PDF.
- class katgpucbf.pytest_plugins.reporter.POTLocator(nbins: int = 10)[source]
Bases:
LocatorTick locator that uses a power-of-two step size.
This code is based on examining the source of MaxNLocator and MultipleLocator. There may be some cargo-culting.
- set_params(nbins: int | None = None) None[source]
Do nothing, and raise a warning. Any locator class not supporting the set_params() function will call this.
- tick_values(vmin: float, vmax: float) Sequence[float][source]
Return the values of the located ticks given vmin and vmax.
Note
To get tick locations with the vmin and vmax values defined automatically for the associated
axissimply call the Locator instance:>>> print(type(loc)) <type 'Locator'> >>> print(loc()) [1, 2, 3, 4]
- class katgpucbf.pytest_plugins.reporter.Reporter(data: list, raw_data: bool = False)[source]
Bases:
objectProvides mechanisms to log steps taken in a test.
If raw_data is true, raw data from line plots in figures will be added to the report.
- detail(message: str) None[source]
Report a low-level detail, associated with the previous call to
step().
- failure(message: str) None[source]
Report a non-fatal test failure.
This should generally not be done directly; use pytest_check.
- figure(figure: Figure) None[source]
Add a matplotlib figure to the report.
- Parameters:
figure – The figure to plot
- katgpucbf.pytest_plugins.reporter.custom_report_log(pytestconfig: Config, data) None[source]
Log a custom JSON line in the report log.
- katgpucbf.pytest_plugins.reporter.plot_focus(ax: Axes, focus: slice, x: ArrayLike, y: ArrayLike, *args, **kwargs) list[Line2D][source]
Plot a line where only an interval is of primary interest.
The parts outside the interval are shown semi-transparent and do not affect the Y scaling. The implementation makes several calls to the underlying plot function.
- Parameters:
ax – Axes on which to plot the line
focus – Slice from x and y which is to be in focus. This must have a step of
Noneand not fall outside the size of x and y.x – Data to plot, which must be 1D and of the same size.
y – Data to plot, which must be 1D and of the same size.
*args – Passed to
matplotlib.axes.Axes.plot().**kwargs – Passed to
matplotlib.axes.Axes.plot().