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, soMatrix({"os": [...]})returned an empty matrix instead of raising.
- tests.test_matrix.test_matrix()[source]¶
Construction, deduplicating
add_variation, rendering, and rejections.includeandexcludeare reserved: they name the directive lists, so accepting them as axis names would shadow the very keyssolvereads.
- tests.test_matrix.test_replace_variation_value()[source]¶
replaceswaps one axis value for another, in place.
- tests.test_matrix.test_remove_variation_value()[source]¶
removedrops an axis value, and the axis once it empties.
- 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_includesaccumulates directives without touching the axes.
- tests.test_matrix.test_excludes()[source]¶
add_excludesaccumulates directives without touching the axes.
- tests.test_matrix.test_product()[source]¶
productis 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 thecolor: pinkan earlier, more specific include set on the cat combinations. Reversing the two would keep pink. Seetest_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 originalos), so GitHub appends it verbatim as one new job. It does not fan back out across the excludedversionaxis: that would require the include to specify eachversionitself.
- 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.