tools, instructions: Abhängigkeiten - Tests biegen config-Pfade über set_config_path um (pytest 9.2), Teardown-Wache; Befehlsreferenz mit typer 0.29 neu erzeugt, typer>=0.29.1, kein click mehr in Tests (#243); 10.2.0-beta.2
CI / verify (push) Successful in 8m31s
CI / pwsh (push) Successful in 2m51s
Converters / converters (push) Successful in 9m42s
Release / converters (push) Successful in 26s
Release / release (push) Successful in 41s
Release / wiki-mirror (push) Skipped
CI / verify (push) Successful in 8m31s
CI / pwsh (push) Successful in 2m51s
Converters / converters (push) Successful in 9m42s
Release / converters (push) Successful in 26s
Release / release (push) Successful in 41s
Release / wiki-mirror (push) Skipped
Files changed: - CHANGES.md - VERSION - docs/reference/commands/configuration.md - docs/reference/commands/content-migrations.md - docs/reference/commands/distribution-and-versioning.md - docs/reference/commands/exports.md - docs/reference/commands/finding-and-checking.md - docs/reference/commands/git.md - docs/reference/commands/pages.md - docs/reference/commands/raw-material-and-uploads.md - docs/reference/commands/types-instructions-and-docs.md - instructions/dev/testing-conventions.md - tools/chemenu/config.py - tools/chemenu/tests/conftest.py - tools/chemenu/tests/test_api.py - tools/chemenu/tests/test_backup.py - tools/chemenu/tests/test_cite_cmd.py - tools/chemenu/tests/test_collect.py - tools/chemenu/tests/test_config_shapes.py - tools/chemenu/tests/test_conventions.py - tools/chemenu/tests/test_corpus_cache.py - tools/chemenu/tests/test_dist_cmd.py - tools/chemenu/tests/test_dist_upgrade.py - tools/chemenu/tests/test_docs_verify.py - tools/chemenu/tests/test_doctor.py - tools/chemenu/tests/test_export_guidelines.py - tools/chemenu/tests/test_export_run.py - tools/chemenu/tests/test_git_publish.py - tools/chemenu/tests/test_hermetic_env.py - tools/chemenu/tests/test_install_doc.py - tools/chemenu/tests/test_instructions_cmd.py - tools/chemenu/tests/test_kb_collections.py - tools/chemenu/tests/test_legacy_settings.py - tools/chemenu/tests/test_lint.py - tools/chemenu/tests/test_log_append.py - tools/chemenu/tests/test_migrate_cmd.py - tools/chemenu/tests/test_new_page.py - tools/chemenu/tests/test_page_ops.py - tools/chemenu/tests/test_pipeline_l0.py - tools/chemenu/tests/test_preflight.py - tools/chemenu/tests/test_provenance.py - tools/chemenu/tests/test_reference_doc.py - tools/chemenu/tests/test_review.py - tools/chemenu/tests/test_settings.py - tools/chemenu/tests/test_task_cmd.py - tools/chemenu/tests/test_telemetry_policy.py - tools/chemenu/tests/test_toc.py - tools/chemenu/tests/test_touch.py - tools/chemenu/tests/test_upload_cmd.py - tools/chemenu/tests/test_version_cmd.py - tools/chemenu/tests/test_work_cmd.py - tools/requirements.txt Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015uxGFdBAmyA23g1isCtGEY
This commit is contained in:
1 parent
832056a0b0
commit
0fce67e6b9
52 files changed
+546
-337
No files matched your search
@@ -66,6 +66,18 @@ Both corpus fixtures therefore repoint it: `raw_dir` and `kb_dir` each set
|
||||
access, so repointing `ROOT` carries `KB_DIR`, `RAW_DIR` and the rest with it. A new fixture
|
||||
that builds a tree does the same thing - that is the rule here, not a per-test judgment.
|
||||
|
||||
**Repoint a path with `set_config_path(monkeypatch, name, value)` from `conftest.py`, never with
|
||||
`monkeypatch.setattr(config, name, value)`.** The names `config` resolves rather than stores
|
||||
(`config.MANAGED_PATHS`: `ROOT` and everything derived from it) break `setattr`'s undo in a way
|
||||
that depends on the pytest version. Up to 9.1 it read the old value through the module
|
||||
`__getattr__` and wrote the resolved path back as a real attribute, so the name stopped
|
||||
following `resolve_root()`; from 9.2 it reads the module dict instead and undoes with `delattr`,
|
||||
which raises, because `hermetic_environment` has already dropped the binding. The first was
|
||||
silent for as long as it lasted; the second turned CI red on the first run that installed
|
||||
pytest 9.2. `set_config_path` patches the module dict
|
||||
as a dict, whose undo copes with either, and a `pytest_runtest_teardown` hook in `conftest.py`
|
||||
fails any test that still leaves a managed path bound after `monkeypatch` is done.
|
||||
|
||||
`kb_dir` did not, until Gitea #44. Two things came of that. A test calling
|
||||
`kb_state.write_kb_state()` overwrote the real `.wikitool-kb.json`, which `git status` made
|
||||
visible within the minute. Quieter and worse: `lint`'s collection lookup resolved a page
|
||||
@@ -135,7 +147,8 @@ Whenever you add or change a test under `tools/chemenu/tests/`.
|
||||
a prefix loop beside it, as `WIKITOOL_SECRET_*` has. A variable the tool reads and the fixture does not clear
|
||||
is the exact hole this whole file is about, reopened.
|
||||
|
||||
5. **Writing a fixture that builds a tree?** Repoint `config.ROOT` at it and call
|
||||
5. **Writing a fixture that builds a tree?** Repoint `config.ROOT` at it with
|
||||
`set_config_path(monkeypatch, "ROOT", tree)` and call
|
||||
`use_shipped_type_specs(monkeypatch)`, as `raw_dir` and `kb_dir` do - see
|
||||
[Which tree a test writes into](#which-tree-a-test-writes-into). A fixture that returns a
|
||||
path without repointing hands the code under test the real repository.
|
||||
|
||||
Reference in new issue
Block a user