tests.test_metadata module¶
Tests for repomatic.metadata.core: the CI metadata singleton and its dump.
- class tests.test_metadata.AnyBool[source]¶
Bases:
objectMatcher that accepts either True or False.
Used for fields that depend on repository state and can vary between test runs.
- class tests.test_metadata.AnyBoolString[source]¶
Bases:
objectMatcher that accepts either ‘true’ or ‘false’ string.
Used for GitHub format booleans that depend on repository state.
- class tests.test_metadata.AnyLengthList(item_pattern)[source]¶
Bases:
objectMatcher for lists where each item matches a pattern, regardless of length.
Used for matrix fields like
commitwhere the number of commits can vary depending on how many are pushed together.
- class tests.test_metadata.StringList(iterable=(), /)[source]¶
Bases:
listA list of plain strings serialized unquoted in GitHub Actions format.
Used for metadata fields like
cli_scriptsthat contain plain string values (not file paths). File path lists use double-quoted space-separated format because the actual metadata holdsPathobjects; plain string lists do not.
- class tests.test_metadata.PartialIncludeList(required_items)[source]¶
Bases:
objectMatcher for include lists where required items must be present.
The nuitka_matrix
includelist contains per-commit entries that multiply when multiple commits are pushed together. This matcher validates that all required items (build targets, entry point info, state) are present, while allowing additional commit-specific items.
- class tests.test_metadata.OptionalMatrix[source]¶
Bases:
objectMatcher for values that can be None or a matrix dict with commit data.
Used for fields like
new_commits_matrixthat areNoneoutside GitHub Actions but contain a matrix dict when running in CI with event data.
- class tests.test_metadata.OptionalMatrixOrEmptyString[source]¶
Bases:
objectMatcher for GitHub format values that can be empty string or a matrix dict.
GitHub Actions format converts None to empty string. In CI, the value is a dict.
- class tests.test_metadata.OptionalVersionString(version_pattern)[source]¶
Bases:
objectMatcher for values that can be None or a version string.
Used for
released_versionwhich isNoneduring development but contains a version string like"5.5.0"on release branches.
- class tests.test_metadata.OptionalVersionOrEmptyString(version_pattern)[source]¶
Bases:
objectMatcher for GitHub format values that can be empty string or a version string.
GitHub Actions format converts None to empty string. On release branches, the value is a version string.
- tests.test_metadata.iter_checks(metadata, expected, context)[source]¶
Recursively iterate over expected content and check it matches in metadata.
- Return type:
- tests.test_metadata.MARKDOWN_EXTENSIONS = ('markdown', 'mdown', 'mkdn', 'mdwn', 'mkd', 'md', 'mdtxt', 'mdtext', 'mdx')¶
The
markdown_filesbrace set, mirroringFileInventory.markdown_files.
- tests.test_metadata.MARKDOWN_INVENTORY = ['.claude/agents/grunt-qa.md', '.claude/agents/qa-engineer.md', '.claude/agents/sphinx-docs.md', '.claude/skills/av-false-positive/SKILL.md', '.claude/skills/awesome-triage/SKILL.md', '.claude/skills/babysit-ci/SKILL.md', '.claude/skills/babysit-ci/references/failure-patterns.md', '.claude/skills/benchmark-update/SKILL.md', '.claude/skills/brand-assets/SKILL.md', '.claude/skills/file-bug-report/SKILL.md', '.claude/skills/github-housekeeping/SKILL.md', '.claude/skills/probe-workflow/SKILL.md', '.claude/skills/repomatic-changelog/SKILL.md', '.claude/skills/repomatic-deps/SKILL.md', '.claude/skills/repomatic-init/SKILL.md', '.claude/skills/repomatic-ship/SKILL.md', '.claude/skills/repomatic-ship/references/deep-pass.md', '.claude/skills/repomatic-ship/references/findings-in-repomatic.md', '.claude/skills/repomatic-ship/references/short-ship.md', '.claude/skills/repomatic-test-matrix/SKILL.md', '.claude/skills/repomatic-topics/SKILL.md', '.claude/skills/repomatic-upgrade/SKILL.md', '.claude/skills/sphinx-docs-sync/SKILL.md', '.claude/skills/translation-sync/SKILL.md', '.claude/skills/upstream-audit/SKILL.md', '.github/code-of-conduct.md', 'AGENTS.md', 'changelog.md', 'docs/agent-skills.md', 'docs/benchmark.md', 'docs/binaries.md', 'docs/changelog-archive.md', 'docs/changelog.md', 'docs/claude-code-plugin.md', 'docs/cli.md', 'docs/cloudflare.md', 'docs/code-of-conduct.md', 'docs/commit-messages.md', 'docs/configuration.md', 'docs/contributing.md', 'docs/dependencies.md', 'docs/history.md', 'docs/index.md', 'docs/install.md', 'docs/license.md', 'docs/man.md', 'docs/nuitka.md', 'docs/operation-contracts.md', 'docs/packaging.md', 'docs/repomatic.awesome_toc.md', 'docs/repomatic.broken_links.md', 'docs/repomatic.bundle.md', 'docs/repomatic.cache.md', 'docs/repomatic.changelog.md', 'docs/repomatic.checks.md', 'docs/repomatic.claude_plugin.md', 'docs/repomatic.cli.ci.md', 'docs/repomatic.cli.deps.md', 'docs/repomatic.cli.github.md', 'docs/repomatic.cli.main.md', 'docs/repomatic.cli.md', 'docs/repomatic.cli.release.md', 'docs/repomatic.cli.repo.md', 'docs/repomatic.cli.site.md', 'docs/repomatic.cli.tools.md', 'docs/repomatic.cloudflare.api.md', 'docs/repomatic.cloudflare.md', 'docs/repomatic.cloudflare.pages.md', 'docs/repomatic.cloudflare.r2.md', 'docs/repomatic.cloudflare.redirects.md', 'docs/repomatic.components.md', 'docs/repomatic.config.md', 'docs/repomatic.data.awesome_template.md', 'docs/repomatic.data.md', 'docs/repomatic.deps.audit.md', 'docs/repomatic.deps.cooldown.md', 'docs/repomatic.deps.graph.md', 'docs/repomatic.deps.lockfile.md', 'docs/repomatic.deps.md', 'docs/repomatic.deps.pins.md', 'docs/repomatic.deps.policy.md', 'docs/repomatic.deps.provenance.md', 'docs/repomatic.deps.report.md', 'docs/repomatic.deps.requirements.md', 'docs/repomatic.deps.shippable.md', 'docs/repomatic.deps.sources.md', 'docs/repomatic.deps.sync.md', 'docs/repomatic.deps.uv.md', 'docs/repomatic.docs.md', 'docs/repomatic.file_inventory.md', 'docs/repomatic.file_ops.md', 'docs/repomatic.frontmatter.md', 'docs/repomatic.git_ops.md', 'docs/repomatic.github.caches.md', 'docs/repomatic.github.ci_status.md', 'docs/repomatic.github.dev_release.md', 'docs/repomatic.github.event.md', 'docs/repomatic.github.gh.md', 'docs/repomatic.github.issue.md', 'docs/repomatic.github.job_timings.md', 'docs/repomatic.github.labels.md', 'docs/repomatic.github.md', 'docs/repomatic.github.outputs.md', 'docs/repomatic.github.pr.md', 'docs/repomatic.github.pr_body.md', 'docs/repomatic.github.release_sync.md', 'docs/repomatic.github.releases.md', 'docs/repomatic.github.runs.md', 'docs/repomatic.github.sponsor.md', 'docs/repomatic.github.status.md', 'docs/repomatic.github.threads.md', 'docs/repomatic.github.token.md', 'docs/repomatic.github.unsubscribe.md', 'docs/repomatic.github.urls.md', 'docs/repomatic.github.workflow_files.md', 'docs/repomatic.github.workflow_sync.md', 'docs/repomatic.gitignore.md', 'docs/repomatic.hashing.md', 'docs/repomatic.http.md', 'docs/repomatic.humanize.md', 'docs/repomatic.images.md', 'docs/repomatic.init.local_edits.md', 'docs/repomatic.init.md', 'docs/repomatic.init.removed_assets.md', 'docs/repomatic.init.run.md', 'docs/repomatic.init.tool_config.md', 'docs/repomatic.init.upgrade.md', 'docs/repomatic.lint_changelog.md', 'docs/repomatic.lint_repo.context.md', 'docs/repomatic.lint_repo.md', 'docs/repomatic.lint_repo.pins.md', 'docs/repomatic.lint_repo.repo.md', 'docs/repomatic.lint_repo.roster.md', 'docs/repomatic.lint_repo.settings.md', 'docs/repomatic.lint_repo.site.md', 'docs/repomatic.lint_repo.tool_config.md', 'docs/repomatic.lint_repo.workflows.md', 'docs/repomatic.mailmap.md', 'docs/repomatic.markdown.md', 'docs/repomatic.matrix.axes.md', 'docs/repomatic.matrix.md', 'docs/repomatic.matrix.model.md', 'docs/repomatic.matrix.runner_sync.md', 'docs/repomatic.matrix.runners.md', 'docs/repomatic.md', 'docs/repomatic.metadata.core.md', 'docs/repomatic.metadata.env.md', 'docs/repomatic.metadata.git.md', 'docs/repomatic.metadata.matrix.md', 'docs/repomatic.metadata.md', 'docs/repomatic.metadata.output.md', 'docs/repomatic.metadata.project.md', 'docs/repomatic.metrics.chart.md', 'docs/repomatic.metrics.forge.md', 'docs/repomatic.metrics.md', 'docs/repomatic.metrics.store.md', 'docs/repomatic.npm.md', 'docs/repomatic.pypi.md', 'docs/repomatic.pyproject.md', 'docs/repomatic.release.attestation.md', 'docs/repomatic.release.binaries_page.md', 'docs/repomatic.release.binary.md', 'docs/repomatic.release.manpages.md', 'docs/repomatic.release.md', 'docs/repomatic.release.prepare_release.md', 'docs/repomatic.release.protocol.md', 'docs/repomatic.release.self_pin.md', 'docs/repomatic.release.verify.md', 'docs/repomatic.release.virustotal.md', 'docs/repomatic.setup_guide.md', 'docs/repomatic.skills.md', 'docs/repomatic.tabular.md', 'docs/repomatic.templates.md', 'docs/repomatic.templating.md', 'docs/repomatic.tooling.binaries.md', 'docs/repomatic.tooling.checksums.md', 'docs/repomatic.tooling.md', 'docs/repomatic.tooling.nuitka.md', 'docs/repomatic.tooling.registry.md', 'docs/repomatic.tooling.runner.md', 'docs/repomatic.upstream.md', 'docs/repomatic.versions.md', 'docs/security.md', 'docs/subagent-grunt-qa.md', 'docs/subagent-qa-engineer.md', 'docs/subagent-sphinx-docs.md', 'docs/subagents.md', 'docs/test-matrix.md', 'docs/tests.conftest.md', 'docs/tests.md', 'docs/tests.test_attestation.md', 'docs/tests.test_awesome_template.md', 'docs/tests.test_awesome_toc.md', 'docs/tests.test_binaries.md', 'docs/tests.test_binaries_page.md', 'docs/tests.test_binary.md', 'docs/tests.test_broken_links.md', 'docs/tests.test_cache.md', 'docs/tests.test_changelog.md', 'docs/tests.test_checks.md', 'docs/tests.test_checksums.md', 'docs/tests.test_ci_status.md', 'docs/tests.test_claude_assets.md', 'docs/tests.test_cli.md', 'docs/tests.test_cloudflare.md', 'docs/tests.test_cloudflare_r2.md', 'docs/tests.test_config.md', 'docs/tests.test_coverage_floor.md', 'docs/tests.test_dep_graph.md', 'docs/tests.test_dep_policy.md', 'docs/tests.test_dep_report.md', 'docs/tests.test_dep_sources.md', 'docs/tests.test_dev_release.md', 'docs/tests.test_docs.md', 'docs/tests.test_docstrings.md', 'docs/tests.test_event.md', 'docs/tests.test_file_ops.md', 'docs/tests.test_forge.md', 'docs/tests.test_frontmatter.md', 'docs/tests.test_gh.md', 'docs/tests.test_git_ops.md', 'docs/tests.test_github_caches.md', 'docs/tests.test_gitignore.md', 'docs/tests.test_hashing.md', 'docs/tests.test_help.md', 'docs/tests.test_http.md', 'docs/tests.test_humanize.md', 'docs/tests.test_images.md', 'docs/tests.test_imports.md', 'docs/tests.test_init_project.md', 'docs/tests.test_issue.md', 'docs/tests.test_job_timings.md', 'docs/tests.test_labels.md', 'docs/tests.test_lint_changelog.md', 'docs/tests.test_lint_repo.md', 'docs/tests.test_mailmap.md', 'docs/tests.test_manpages.md', 'docs/tests.test_markdown.md', 'docs/tests.test_matrix.md', 'docs/tests.test_metadata.md', 'docs/tests.test_metadata_git.md', 'docs/tests.test_metrics.md', 'docs/tests.test_npm.md', 'docs/tests.test_nuitka.md', 'docs/tests.test_outputs.md', 'docs/tests.test_pages_redirects.md', 'docs/tests.test_platform_keys.md', 'docs/tests.test_plugin.md', 'docs/tests.test_plugin_update_detection.md', 'docs/tests.test_pr.md', 'docs/tests.test_pr_body.md', 'docs/tests.test_prepare_release.md', 'docs/tests.test_protocol.md', 'docs/tests.test_provenance.md', 'docs/tests.test_pypi.md', 'docs/tests.test_pyproject.md', 'docs/tests.test_readme.md', 'docs/tests.test_release_sync.md', 'docs/tests.test_release_workflow_steps.md', 'docs/tests.test_releases.md', 'docs/tests.test_runner_catalog.md', 'docs/tests.test_runner_sync.md', 'docs/tests.test_runs.md', 'docs/tests.test_self_pin.md', 'docs/tests.test_setup_guide.md', 'docs/tests.test_skills.md', 'docs/tests.test_sphinx_crossrefs.md', 'docs/tests.test_sponsor.md', 'docs/tests.test_status.md', 'docs/tests.test_suite_hygiene.md', 'docs/tests.test_sync_ops.md', 'docs/tests.test_tabular.md', 'docs/tests.test_templating.md', 'docs/tests.test_threads.md', 'docs/tests.test_todolist.md', 'docs/tests.test_token.md', 'docs/tests.test_tool_runner.md', 'docs/tests.test_unsubscribe.md', 'docs/tests.test_upstream.md', 'docs/tests.test_urls.md', 'docs/tests.test_uv.md', 'docs/tests.test_verify.md', 'docs/tests.test_version_sync.md', 'docs/tests.test_versions.md', 'docs/tests.test_virustotal.md', 'docs/tests.test_vulnerable_deps.md', 'docs/tests.test_workflow_files.md', 'docs/tests.test_workflow_sync.md', 'docs/tests.test_workflows.md', 'docs/todolist.md', 'docs/tool-runner.md', 'docs/upstream-development.md', 'docs/upstream.md', 'docs/workflows.md', 'readme.md', 'repomatic/data/awesome_template/.github/code-of-conduct.md', 'repomatic/data/awesome_template/.github/contributing.md', 'repomatic/data/awesome_template/.github/contributing.zh.md', 'repomatic/data/awesome_template/.github/pull_request_template.md', 'repomatic/templates/available-admonition.md', 'repomatic/templates/broken-links-issue.md', 'repomatic/templates/bump-version.md', 'repomatic/templates/development-warning.md', 'repomatic/templates/fix-changelog.md', 'repomatic/templates/fix-typos.md', 'repomatic/templates/fix-vulnerable-deps.md', 'repomatic/templates/format-images.md', 'repomatic/templates/format-json.md', 'repomatic/templates/format-markdown.md', 'repomatic/templates/format-pyproject.md', 'repomatic/templates/format-python.md', 'repomatic/templates/format-shell.md', 'repomatic/templates/generated-footer.md', 'repomatic/templates/github-releases.md', 'repomatic/templates/immutable-releases.md', 'repomatic/templates/refresh-tip.md', 'repomatic/templates/release-notes.md', 'repomatic/templates/sample-metrics.md', 'repomatic/templates/scan-virustotal.md', 'repomatic/templates/setup-guide-branch-ruleset.md', 'repomatic/templates/setup-guide-cloudflare-pages.md', 'repomatic/templates/setup-guide-cloudflare-r2.md', 'repomatic/templates/setup-guide-dependabot.md', 'repomatic/templates/setup-guide-fork-pr-approval.md', 'repomatic/templates/setup-guide-notifications-pat.md', 'repomatic/templates/setup-guide-pages-source.md', 'repomatic/templates/setup-guide-pypi-trusted-publisher.md', 'repomatic/templates/setup-guide-sha-pinning-required.md', 'repomatic/templates/setup-guide-token.md', 'repomatic/templates/setup-guide-verify.md', 'repomatic/templates/setup-guide-virustotal.md', 'repomatic/templates/setup-guide.md', 'repomatic/templates/squashed-release.md', 'repomatic/templates/sync-action-pins.md', 'repomatic/templates/sync-bumpversion.md', 'repomatic/templates/sync-dep-sources.md', 'repomatic/templates/sync-gitignore.md', 'repomatic/templates/sync-mailmap.md', 'repomatic/templates/sync-repomatic-upgrade.md', 'repomatic/templates/sync-repomatic.md', 'repomatic/templates/sync-runner-images.md', 'repomatic/templates/sync-tool-versions.md', 'repomatic/templates/sync-uv-lock.md', 'repomatic/templates/sync-workflow-pins.md', 'repomatic/templates/unavailable-admonition.md', 'repomatic/templates/unsubscribe-report.md', 'repomatic/templates/update-dep-graph.md', 'repomatic/templates/update-docs.md', 'repomatic/templates/upgrade-invite.md', 'repomatic/templates/yanked-admonition.md']¶
Every Markdown file tracked in the repository, in
glob_filesorder.Backs both
doc_filesandmarkdown_files. The two metadata keys glob different extension sets:doc_filesalso takes.rstand.tex. They coincide only because the repository currently ships neither, so the day one lands the two expectations below have to diverge.
- tests.test_metadata.test_dump_factories_match_key_descriptions()[source]¶
The three views of the key inventory must name the same keys.
_METADATA_KEY_DESCRIPTIONS(what--list-keysand the docs table show),Metadata.dump_factories(what the command emits) andall_metadata_keys(what the command accepts as an argument) are three hand-maintained lists sitting far apart in the module. A description without a factory makesrepomatic show-metadata <key>accept the key and then emit nothing; a factory without a description drops the key from--list-keysand the rendered docs.
- tests.test_metadata.test_metadata_keys_reference_documents_every_key()[source]¶
Every emitted key needs a non-empty description in the reference table.
- tests.test_metadata.test_config_defaults_render_as_github_values(field_name)[source]¶
Every config field exposed as metadata must survive GitHub encoding.
A nested config dataclass has no GitHub encoding, so listing one in
METADATA_CONFIG_FIELDSmakesrepomatic show-metadataraiseNotImplementedErroron every run. Checking the dataclass defaults rather than this repository’s own values keeps the guard on the declared surface.
- tests.test_metadata.test_metadata_config_fields_are_sorted_config_fields()[source]¶
Each allowed name is a
Configfield, so a renamed field fails here.
- tests.test_metadata.test_metadata_config_fields_are_read_by_a_workflow(field_name)[source]¶
A config field joins the metadata output only for a workflow to read.
The subcommands read
[tool.repomatic]themselves, so an allowed field no workflow mentions is surface nobody consumes.
- tests.test_metadata.test_file_group_keys_are_inventory_attributes()[source]¶
Every file-group key names an output key and an inventory attribute.
- tests.test_metadata.test_file_inventories_are_not_vacuous()[source]¶
The git-derived inventories really enumerate the tree.
Guards the
_tracked_inventoryderivations against a filter typo silently emptying a list: each inventory must contain a signature file that will exist for the life of the project, and the symlink collapse must keep targets, never link names.
- tests.test_metadata.test_gitignore_is_decoded_as_utf8_whatever_the_locale(tmp_path)[source]¶
A non-ASCII
.gitignorepattern matches under a locale that is not UTF-8.py-walk decodes the file with the locale encoding, so the inventory decodes it itself. The probe runs in an interpreter of its own, because the locale is fixed when an interpreter starts. It is a file and not a
-cargument: Python reads a source file as UTF-8 under any locale, and its command line with the locale encoding.
- tests.test_metadata.test_exclude_file_rules_apply_below_gitignore(tmp_path, monkeypatch)[source]¶
The exclude file filters the inventory, and
.gitignoreoverrides it.Git reads
info/excludebeside.gitignore, and gives.gitignorethe last word: a file that the exclude rules drop comes back when.gitignorenegates it.
- tests.test_metadata.test_linked_worktree_reads_the_exclude_file_of_its_main_checkout(tmp_path, monkeypatch)[source]¶
A linked worktree follows its
.gitfile to the shared exclude file.Git writes the
.gitfile and thecommondirfile of a linked worktree in this layout, and keeps one exclude file for every worktree.
- tests.test_metadata.test_dot_git_file_layouts(tmp_path, monkeypatch, dot_git, exclude, kept)[source]¶
A
.gitfile finds the exclude file only through itsgitdir:line.Git writes the
.gitfile of a submodule in this layout: its git directory sits in the superproject and holds nocommondirfile, so the exclude file is the one of that directory.
- tests.test_metadata.test_glob_files_resolves_links(tmp_path, monkeypatch)[source]¶
A dangling link is dropped, and a link out of the directory stays absolute.
- tests.test_metadata.test_shell_groups_split_sh_files_on_their_shebang(tmp_path, monkeypatch)[source]¶
A
.shfile joins the group its shebang names, read once per inventory.
- tests.test_metadata.test_metadata_command_renders_under_captured_runner()[source]¶
repomatic show-metadatarenders to a captured stdout that has no descriptor.The docs
{click:run}directive live-renders this command through click-extra’s in-memory runner, which is Click’s defaultcapture="sys"mode: its stdout has nofileno().prep_pathmust degrade to that stream rather than reopening its descriptor, and a bare stdout run must stay silent (no spurious overwrite warning) so the rendered block is pure JSON. Seerepomatic.cli.main.write_output.
- tests.test_metadata.test_python_version_sort_key_orders_by_release(versions, expected)[source]¶
Versions sort numerically, a flavor right after its base version.
- tests.test_metadata.test_show_test_matrix_renders_full_grid()[source]¶
--gridrenders the full matrix as a labelled grid.
- tests.test_metadata.test_show_test_matrix_rows_sorted_by_release(view)[source]¶
Both views order Python rows by release, flavors after their base.
- tests.test_metadata.test_show_test_matrix_columns_follow_canonical_order(matrix_name, canonical)[source]¶
Grid OS columns follow the runner order of the axis constants.
- tests.test_metadata.test_show_test_matrix_pr_is_reduced()[source]¶
The
prargument selects a grid with fewer rows and columns thanfull.
- tests.test_metadata.test_show_test_matrix_no_emoji_uses_plain_words()[source]¶
--no-emojirenders bare state words, deriving the expectation from config.
- tests.test_metadata.test_format_matrix_cell_labels_every_state()[source]¶
Each state of a cell shared by several jobs gets its own glyph.
- tests.test_metadata.test_format_matrix_cell_counts_jobs_past_the_first(state, label)[source]¶
A state carrying several jobs says how many; a lone job stays bare.
- tests.test_metadata.test_format_matrix_cell_marks_an_empty_intersection()[source]¶
A cell no job occupies renders the placeholder.
- tests.test_metadata.test_show_test_matrix_pivots_on_the_chosen_axes()[source]¶
–row-axis and –col-axis transpose the grid onto the named job keys.
- tests.test_metadata.test_flat_matrix_table_columns_every_key_with_the_state_last()[source]¶
Every key any job carries becomes a column, the state landing last.
- tests.test_metadata.test_flat_matrix_table_leads_with_the_keys_it_is_given()[source]¶
Leading keys column first, in order. One no job carries is skipped.
- tests.test_metadata.test_show_test_matrix_lists_every_job_by_default()[source]¶
With no –grid, the command renders one row per solved job.
- tests.test_metadata.test_show_test_matrix_grid_collapses_the_listing()[source]¶
–grid trades the one-row-per-job listing for the two-axis pivot.
The listing is lossless and the grid is not, so the grid never has more rows than there are values on its row axis.
- tests.test_metadata.test_show_test_matrix_rejects_an_unknown_axis()[source]¶
An axis no job carries is refused, naming the keys the matrix has.
- tests.test_metadata.FRUIT_AXIS_PYPROJECT = '[project]\nname = "orchard"\nversion = "1.0.0"\n\n[tool.repomatic.test-matrix.variations]\nfruit = ["papaya", "kiwi", "mango"]\n'¶
A full-matrix axis with no canonical order, its values declared unsorted.
- tests.test_metadata.test_show_test_matrix_refuses_a_full_only_axis_on_pr(tmp_path, monkeypatch)[source]¶
An axis the
prmatrix drops is refused there, though the full one has it.
- tests.test_metadata.test_show_test_matrix_keeps_job_order_on_an_axis_without_one(tmp_path, monkeypatch, view, axis_option)[source]¶
An axis with no canonical order lists its values in job order, unsorted.
- tests.test_metadata.test_show_test_matrix_help_lists_the_axis_keys(axis_option)[source]¶
Both axis options render the keys they accept as a Choice metavar.
- tests.test_metadata.test_show_test_matrix_help_and_validation_read_the_same_keys()[source]¶
The listing offered and the set enforced come from one source.
A hand-kept help string is what drifts: it would keep naming an axis the matrix dropped, or miss the
[tool.repomatic.test-matrix]variation this project just added.
- tests.test_metadata.test_matrix_axis_falls_back_to_the_universal_keys(monkeypatch)[source]¶
An unreadable matrix leaves the keys every matrix carries, never none.
Empty choices would refuse this option’s own default, so a matrix that failed to compute would take the whole command down with it.
- tests.test_metadata.test_matrix_axis_completes_the_keys_it_lists()[source]¶
Shell completion offers the same keys, filtered on what is typed.
- tests.test_metadata.test_show_test_matrix_rejects_unknown_name()[source]¶
An unknown matrix name is rejected by the Choice argument.
- tests.test_metadata.test_dev_targets_default()[source]¶
Without config, the canary subset is the fastest Linux arm builder.
- tests.test_metadata.test_dev_targets_discards_unknown(tmp_path, monkeypatch, caplog)[source]¶
Unknown dev target names are warned about and dropped.
- tests.test_metadata.test_nuitka_matrix_canary_on_push(monkeypatch)[source]¶
An ordinary CI push compiles only the dev-targets canary subset.
- tests.test_metadata.test_nuitka_matrix_full_fleet_on_schedule(monkeypatch)[source]¶
The weekly scheduled run rebuilds every target.
- tests.test_metadata.test_nuitka_matrix_full_fleet_on_release_push(monkeypatch)[source]¶
A push carrying a release commit rebuilds every target.
- tests.test_metadata.test_nuitka_matrix_full_fleet_locally()[source]¶
Outside CI (no event), the matrix keeps the full roster.
- tests.test_metadata.test_nuitka_matrix_needs_no_module_file(tmp_path, monkeypatch)[source]¶
An entry point reaches the matrix whatever the layout of its project.
Nuitka imports the module by name, so the matrix never looks for a file. No
papaya/__main__.pyexists below the working directory, which is what a src-layout project leaves at the path its module name spells.
- tests.test_metadata.test_nuitka_matrix_names_binaries_without_a_declared_version(tmp_path, monkeypatch)[source]¶
A commit declaring no version still yields a matrix, of versionless names.
A project with no bump-my-version configuration leaves
current_versionout of each commit entry, so every binary takes its stable alias name.
- tests.test_metadata.test_nuitka_matrix_skips_push_without_dev_targets(monkeypatch)[source]¶
An empty dev-targets list disables binary builds on ordinary pushes.
- tests.test_metadata.test_nuitka_matrix_is_empty_when_the_build_is_skipped(monkeypatch)[source]¶
An event that cannot change a binary leaves nothing to compile.
- tests.test_metadata.test_nuitka_matrix_gates_the_compile_cache(monkeypatch, release)[source]¶
Each target tells its compile job whether to keep a cache.
Release commits build cold, and a target compiling without ccache keeps no cache at all. The flag is a string, as every matrix value is.
- tests.test_metadata.test_manpages_asset_name(tmp_path, monkeypatch, configured, package, expected)[source]¶
The tarball stem defaults to the package name, unless configured.
- tests.test_metadata.test_null_sha_constant()[source]¶
Test that NULL_SHA is a valid 40-character string of zeros.
This constant is used to detect when GitHub sends a null SHA as the “before” commit when a tag is created (since there is no previous commit).
- tests.test_metadata.test_is_bot_false_by_default(monkeypatch)[source]¶
Test that is_bot is False when not in a bot context.
- tests.test_metadata.test_ci_context_properties(monkeypatch, prop, envvar, value)[source]¶
Test CI context properties read from environment variables.
- tests.test_metadata.test_ci_context_defaults(monkeypatch)[source]¶
Test CI context properties return None when env vars are unset.
- tests.test_metadata.test_ci_context_empty_is_none(monkeypatch, prop, envvar)[source]¶
Test that empty env var values are normalized to None.
- tests.test_metadata.test_repo_name_derived_from_slug(monkeypatch)[source]¶
Test that repo_name is derived from repo_slug.
- tests.test_metadata.test_repo_slug_fallback_chain(monkeypatch, gh_slug, remote_slug, expected)[source]¶
Without
GITHUB_REPOSITORY, the slug falls back to the remote, then gh.Both fallbacks are stubbed rather than probed: on a runner with no
ghauth the real chain yieldsNone, which is what made the original pair of tests assert nothing at all on CI.
- tests.test_metadata.test_repo_name_fallback_to_gh_cli(monkeypatch)[source]¶
repo_nameis the trailing segment of a gh-resolved slug.
- tests.test_metadata.test_is_awesome(monkeypatch, repo, expected)[source]¶
Test that is_awesome detects awesome-* repository names.
- tests.test_metadata.test_is_awesome_none_slug(monkeypatch)[source]¶
Test that is_awesome returns False when repo_slug is None.
- tests.test_metadata.test_repo_owner_fallback_to_slug(monkeypatch)[source]¶
Test that repo_owner falls back to owner from repo_slug.
- tests.test_metadata.test_repo_url_composed(monkeypatch)[source]¶
Test that repo_url is composed from server_url and repo_slug.
- tests.test_metadata.test_repo_url_fallback(monkeypatch)[source]¶
repo_urlcomposes the default server with a gh-resolved slug.
- tests.test_metadata.test_repo_url_none_without_a_slug(monkeypatch)[source]¶
No slug from any source leaves the URL undefined rather than malformed.
- tests.test_metadata.test_server_url_default(monkeypatch)[source]¶
Test that server_url defaults to https://github.com.
- tests.test_metadata.test_repomatic_config_defaults(tmp_path, monkeypatch)[source]¶
Test that [tool.repomatic] config properties return sensible defaults.
- tests.test_metadata.test_full_include_flattens_matrix(tmp_path, monkeypatch)[source]¶
full-includerows emit as standalone jobs in a flat matrix.A full-include cell sharing its
os/python-versionwith a shipped-config combination must add a new job, not overwrite that combination, and the matrix must serialize as a flat{"include": [...]}list so GitHub runs the rows verbatim.
- tests.test_metadata.test_full_include_backfills_probe_defaults(tmp_path, monkeypatch)[source]¶
Free-threaded probe jobs inherit the single-key default includes.
The 3.15t probe is a standalone include pinned to one runner, appended by
solve()and never augmented by GitHub’s include algorithm. The flat full-include matrix backfills the matrix defaults onto it, so it never emits an emptyclick-version/cloup-versionthat GitHub would expand to""and a downstream run step would mishandle.
- tests.test_metadata.test_repomatic_config_custom_values(tmp_path, monkeypatch)[source]¶
Test that [tool.repomatic] config properties read from pyproject.toml.
- tests.test_metadata.test_test_matrix_config_exclude(tmp_path, monkeypatch)[source]¶
Test that test-matrix.exclude removes combos from both matrices.
- tests.test_metadata.test_test_matrix_config_variations(tmp_path, monkeypatch)[source]¶
Test that test-matrix.variations adds to full matrix only.
- tests.test_metadata.test_test_matrix_config_include(tmp_path, monkeypatch)[source]¶
Test that test-matrix.include adds directives to both matrices.
- tests.test_metadata.test_test_matrix_config_replace(tmp_path, monkeypatch)[source]¶
Test that test-matrix.replace swaps axis values in both matrices.
- tests.test_metadata.test_test_matrix_config_remove(tmp_path, monkeypatch)[source]¶
Test that test-matrix.remove drops axis values from both matrices.
- tests.test_metadata.test_test_matrix_config_unstable(tmp_path, monkeypatch)[source]¶
Test test-matrix.unstable flags full-matrix combos and skips the PR matrix.
- tests.test_metadata.test_single_runner_python_versions_are_stable_and_pinned(tmp_path, monkeypatch)[source]¶
Each released flavor runs once, on its pinned runner, stable; never in PR.
Locks the SINGLE_RUNNER_PYTHON_VERSIONS contract for every entry: a free-threaded build is a single-runner smoke test, not the full cross-platform spread, and not an unstable probe.
- tests.test_metadata.test_unstable_python_versions_carry_a_prerelease_label(tmp_path, monkeypatch)[source]¶
Each in-development Python gets a display label; the axis keeps the version.
The label is what the CI job name shows, so an unstable cell reads
py3.16-devand says why it may fail rather than looking like any released one. Adding a version to UNSTABLE_PYTHON_VERSIONS and forgetting its label is the failure this catches.Label and axis value stay separate on purpose:
uv venv --python, whichtests.yamlfeeds frompython-version, does not parse the-devspelling, and downstream[tool.repomatic.test-matrix]directives key on the bare version.
- tests.test_metadata.test_stale_test_matrix_excludes(tmp_path, monkeypatch)[source]¶
Test detection of test-matrix.exclude entries that match no live axis.
- tests.test_metadata.test_unstable_targets_default(tmp_path, monkeypatch)[source]¶
Test that unstable_targets defaults to an empty set.
- tests.test_metadata.test_unstable_targets_ignores_unknown(tmp_path, monkeypatch)[source]¶
Test that unrecognized unstable targets are discarded with a warning.
- tests.test_metadata.ALIASED_SCRIPTS = 'short = "my_pkg.__main__:main"\nlong-name = "my_pkg.__main__:main"\n'¶
Two entry points sharing one callable.
- tests.test_metadata.test_nuitka_entry_points(tmp_path, monkeypatch, scripts, config, expected)[source]¶
nuitka.entry-pointspicks the scripts; the default drops aliases.
- tests.test_metadata.test_script_entries_basic(tmp_path, monkeypatch)[source]¶
Well-formed
[project.scripts]entries parse into (name, module, callable).
- tests.test_metadata.test_script_entries_rejects_unsafe_name(tmp_path, monkeypatch, name)[source]¶
Script names that PyPI / uv-build would refuse are rejected up front.
- tests.test_metadata.test_script_entries_rejects_malformed_value(tmp_path, monkeypatch, value)[source]¶
Values not of the form
module:objectraise a descriptive error.
- tests.test_metadata.test_unknown_metadata_keys_reads_every_step()[source]¶
Each step calling the subcommand is listed, with the keys it gets wrong.
The singleton reads the same cached document every other reader gets.
- tests.test_metadata.test_metadata_config_follows_the_published_config(tmp_path, monkeypatch)[source]¶
The command’s published config is the singleton’s config too.
- tests.test_metadata.test_metadata_config_warns_once_about_an_unknown_key(tmp_path, monkeypatch, caplog)[source]¶
The singleton and a library helper report a stale key once between them.
- tests.test_metadata.test_sphinx_extensions_reads_every_assignment_shape(tmp_path, monkeypatch, conf, expected)[source]¶
Every assignment shape of
conf.pyreads, and none crashes.A tuple or subscript target carries no name, and reading one as if it did crashed
show-metadataandupdate-docson the project assigning it.
- tests.test_metadata.test_sphinx_extensions_without_sphinx(tmp_path, monkeypatch)[source]¶
A project with no Sphinx configuration lists no extension.
- tests.test_metadata.test_sphinx_conf_strings_reads_the_named_variable(tmp_path, monkeypatch)[source]¶
Each variable reads on its own, and a value that is no list reads empty.
- tests.test_metadata.test_github_dialect_trims_an_oversized_heredoc(caplog)[source]¶
A heredoc value past the step-output ceiling is trimmed, with a warning.
A consuming step receives the value in its environment, and a value past the ceiling kills that step with
E2BIGbefore its command starts.
- tests.test_metadata.test_event_type_needs_the_event_name(monkeypatch, caplog, base_ref)[source]¶
Without
GITHUB_EVENT_NAMEthe event is unknown, whatever else is set.
- tests.test_metadata.test_event_type_reads_the_event_name(monkeypatch, event_name, expected)[source]¶
The event name maps onto its member, and an unknown one onto nothing.
- tests.test_metadata.test_is_bot_reads_the_sender_then_the_login(monkeypatch, actor, sender, expected)[source]¶
A GitHub App sender is a bot, and so is the Dependabot login alone.
- tests.test_metadata.test_matrix_name_designates_its_matrix(name, runners, python_versions, attribute)[source]¶
Each matrix name seeds its axes and designates its metadata key.
- tests.test_metadata.test_current_version_reads_the_most_recent_commit(monkeypatch)[source]¶
A release push reports the post-release version of its most recent commit.
The commit matrix lists the new commits oldest first, so the release commit comes before the post-release bump that follows it.
- tests.test_metadata.test_main_cli_script_and_its_import_name(tmp_path, monkeypatch, scripts, main_script, import_name)[source]¶
The first script names the CLI, and its module names the import package.
The module wins over the package name, which can differ from it. A project with no script falls back to the package name, hyphens turned into underscores.
- tests.test_metadata.test_builds_sphinx_needs_a_python_project_and_a_sphinx_config(monkeypatch, python_project, sphinx, expected)[source]¶
The Sphinx build installs the project, so it needs both to run.
- tests.test_metadata.LATEST_STABLE = '3.15'¶
The newest released Python of the default axes, which the PR matrix runs too.
- tests.test_metadata.PLAIN_RELEASES = ['3.11', '3.15']¶
The plain releases of the default
python-versionaxis.
- tests.test_metadata.test_latest_stable_python_reads_the_configured_axis(tmp_path, monkeypatch, matrix_config, expected)[source]¶
The key follows the project’s axis, and skips flavors and dev versions.
The free-threaded flavor and the in-development version stay on the full matrix in every case here, so an axis left with only those has no answer.
- tests.test_metadata.test_cloudflare_project_falls_back_to_the_repository_name(monkeypatch, declared, expected)[source]¶
site.cloudflare-projectnames the project, else the repository does.
- tests.test_metadata.test_github_json_keeps_a_list_of_mappings_as_an_array()[source]¶
A list of mappings reaches the workflow as a JSON array, not a string.
A workflow hands it to
strategy.matrix.includeas it is. A list of words still joins into one string, and an empty one into the empty string anif:gate reads as false.