tests.test_matrix module

Tests for repomatic.github.matrix: the workflow matrix model.

tests.test_matrix.test_matrix_constructor_takes_no_arguments()[source]

A matrix is populated through its methods, never through the constructor.

The signature used to swallow *args, **kwargs, so Matrix({"os": [...]}) returned an empty matrix instead of raising.

tests.test_matrix.test_matrix()[source]

Construction, deduplicating add_variation, rendering, and rejections.

include and exclude are reserved: they name the directive lists, so accepting them as axis names would shadow the very keys solve reads.

tests.test_matrix.test_replace_variation_value()[source]

replace swaps one axis value for another, in place.

tests.test_matrix.test_remove_variation_value()[source]

remove drops an axis value, and the axis once it empties.

tests.test_matrix.test_prune(caplog)[source]

Prune removes no-op excludes and logs about them.

tests.test_matrix.test_remove_variation_value_solve()[source]

Exclude prevents resurrection; removal also strips the axis value.

tests.test_matrix.test_solve_matches_github_include_example()[source]

solve() reproduces GitHub’s documented matrix include expansion.

The canonical example from GitHub’s docs: later includes augment base combinations only, never combinations a previous include created, and an include that matches no combination is appended.

tests.test_matrix.test_solve_partial_include_does_not_resurrect_excluded()[source]

A partial include augments survivors without resurrecting excluded combos.

tests.test_matrix.test_solve_full_include_resurrects_excluded()[source]

A fully-specified include adds back an excluded combination (GitHub behavior).

tests.test_matrix.test_replace_variation_value_solve()[source]

Replacement integrates correctly with the full solve pipeline.

tests.test_matrix.test_includes()[source]

add_includes accumulates directives without touching the axes.

tests.test_matrix.test_excludes()[source]

add_excludes accumulates directives without touching the axes.

tests.test_matrix.test_all_variations()[source]

all_variations reports every axis and its values.

tests.test_matrix.test_product()[source]

product is the plain cartesian product, before include/exclude.

tests.test_matrix.test_solve_includes_are_order_sensitive()[source]

Later includes overwrite non-axis values added by earlier ones.

GitHub applies includes sequentially, so {color: green} (added to every combination) overwrites the color: pink an earlier, more specific include set on the cat combinations. Reversing the two would keep pink. See test_solve_matches_github_include_example() for the documented order.

tests.test_matrix.test_solve_expanded_configuration()[source]

GitHub’s documented include example: a matching include expands one cell.

tests.test_matrix.test_solve_extended_configuration()[source]

GitHub’s documented include example: a non-matching include appends a job.

tests.test_matrix.test_solve_empty_matrix()[source]

Includes alone define the jobs when no axis is declared.

tests.test_matrix.test_solve_excludes(excludes)[source]

Excludes remove matching cells, whatever order they are declared in.

tests.test_matrix.test_solve_exclude_partial(excludes)[source]

A partial exclude removes every cell sharing the named values.

tests.test_matrix.test_solve_exclude_include_priority()[source]

A partial include re-added after exclude is a single job, not a slice.

The include {os: linux-latest} matches no surviving combination (adding it would overwrite the original os), so GitHub appends it verbatim as one new job. It does not fan back out across the excluded version axis: that would require the include to specify each version itself.

tests.test_matrix.test_solve_exclude_include_selectivity()[source]

A fully-qualified include survives an exclude that removes its siblings.

tests.test_matrix.test_strict_mode_unknown_exclude_key()[source]

Strict mode rejects an exclude naming an axis the matrix never declared.

tests.test_matrix.test_pivot_basic()[source]

pivot() lays solved jobs out as a row-axis by col-axis grid.

tests.test_matrix.test_pivot_excluded_cell_is_missing()[source]

An excluded combination renders the missing placeholder.

tests.test_matrix.test_pivot_marks_unstable_row()[source]

A partial state include flags the matching row’s cells unstable.

tests.test_matrix.test_pivot_multi_job_cell_joins_states()[source]

Several jobs at one intersection join their distinct states.

tests.test_matrix.test_pivot_counts_tallies_the_jobs_behind_each_cell()[source]

A cell collapsing several jobs counts them, per distinct state.

tests.test_matrix.test_pivot_counts_omits_an_empty_intersection()[source]

An excluded combination is absent, not present with an empty counter.

tests.test_matrix.test_pivot_custom_axes_and_missing_marker()[source]

pivot() accepts arbitrary axes, cell key and missing placeholder.