Skip to content

test: adopt the shared configuration helpers across the test suite - #476

Merged
has2k1 merged 3 commits into
refactor/config-user-settingsfrom
refactor/adopt-test-helpers
Oct 29, 2026
Merged

has2k1 merged 3 commits into
refactor/config-user-settingsfrom
refactor/adopt-test-helpers

Conversation

@has2k1

@has2k1 has2k1 commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

This PR replaces the per-file helpers that wrote and loaded great-docs.yml, and the MagicMock configuration doubles, with the shared write_config and mock_config helpers in tests/support.py.

Eleven test files each carried their own copy of the write-and-load helper, some with their own defaults. The MagicMock doubles read any setting a test forgot to set as true, so a test could pass through a branch other than the one it was written for; mock_config reads unset settings as empty and rejects names Config does not have.

Replace module-local helpers that wrote and loaded `great-docs.yml`, and
matching inline write-and-load pairs, with the shared `write_config` helper
from test support. Each call supplies its YAML directly, including
`show_dates: true`, previously a module default, and `site: lang`, previously
composed from a language code.

Configurations previously written to a separate `config` subdirectory now
load from each test's own directory.
Use the shared `mock_config` double for project configuration. It rejects
settings absent from the real configuration. The previous mocks had no
specification, so unset settings evaluated as true.

Each test already supplies the settings its code path reads, so test
behaviour is unchanged.
Use the shared `mock_config` double for project configuration. The previous
mocks had no specification, so unset settings evaluated as true. The double
provides empty `user_settings` and no sections unless a test overrides them.

Remove seven stubs for a `get` method that the real configuration does not
have and lint never called.
@has2k1
has2k1 added this pull request to stack #477 October 29, 2026 16:51
@github-actions

Copy link
Copy Markdown

📚 Preview this PR's docs locally

Fetch the just-built site and open it in your browser:

# this exact build
great-docs preview --run 40915693034

# or always the latest build for this PR
great-docs preview --pr 476
Auth & tips
  • Requires great-docs: pip install great-docs (or run via pipx/uvx).
  • Auth: run gh auth login then add --use-gh, or set GITHUB_TOKEN (needs Actions: read).
  • Jump to a page: add --path reference/index.html.
  • Latest vs exact: --pr <n> grabs the newest build; --run <id> pins this one.
  • Re-download: --refresh ignores the local cache.

@has2k1
has2k1 merged commit a38b55f into main Oct 29, 2026
9 checks passed
@has2k1
has2k1 deleted the refactor/adopt-test-helpers branch October 31, 2026 21:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant