tests.test_matrix module¶
Tests for repomatic.matrix.model: 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_add_variation_reads_a_generator_once()[source]¶
A generator of values lands whole, rather than consumed by the checks.
- 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_include_and_exclude_directives(directive)[source]¶
add_includesandadd_excludesaccumulate 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.
An exclude naming a key outside the axes matches on the keys it shares.
- tests.test_matrix.test_solve_reports_a_matrix_past_the_job_limit(caplog)[source]¶
GitHub refuses a matrix past its job limit, so the solver says so.
- tests.test_matrix.test_job_keys_reads_the_solved_jobs()[source]¶
A key only an include sets is listed; an axis no job keeps is not.
- tests.test_matrix.test_pivot_counts_marks_an_unstable_row()[source]¶
A partial state include flags the matching row’s cells unstable.
- tests.test_matrix.test_pivot_counts_tallies_the_jobs_behind_each_cell()[source]¶
A cell collapsing several jobs counts them, per distinct state.