test_tests_section.py¶
tests/test_tests_section.py
One top-level `tests:` section: where the tests are, and the evidence they leave (R5-CFG F20).
test_an_unknown_tests_key_is_refused
None test_tests_section.test_an_unknown_tests_key_is_refused(Path tmp_path)
A misspelled tests key is refused by name.
tests/test_tests_section.py:67
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-CONFIG-001 | measured | test_an_unknown_tests_key_is_refused → load_declaration |
| REQ-DDB-GUARD-012 | inferred | test_an_unknown_tests_key_is_refused → load_declaration → load_declaration_located → _checked_sections → _checked_section → _checked_requirements → _validate_node |
| REQ-DDB-WIKI-054 | inferred | test_an_unknown_tests_key_is_refused → load_declaration → load_declaration_located → _checked_sections → _checked_section → _checked_list_section → all |
Source · 6 lines
def test_an_unknown_tests_key_is_refused(tmp_path: Path) -> None:
"""@brief A misspelled tests key is refused by name."""
with pytest.raises(DeclarationError, match="junti"):
load_declaration(_write(tmp_path, "tests:\n junti: [j.xml]\n"))
Activity · 2 steps
test_test_paths_is_refused_with_a_pointer
None test_tests_section.test_test_paths_is_refused_with_a_pointer(Path tmp_path)
`test_paths:` moved to `tests.paths`.
tests/test_tests_section.py:53
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-CONFIG-001 | measured | test_test_paths_is_refused_with_a_pointer → load_declaration |
| REQ-DDB-GUARD-012 | inferred | test_test_paths_is_refused_with_a_pointer → load_declaration → load_declaration_located → _checked_sections → _checked_section → _checked_requirements → _validate_node |
| REQ-DDB-WIKI-054 | inferred | test_test_paths_is_refused_with_a_pointer → load_declaration → load_declaration_located → _checked_sections → _checked_section → _checked_list_section → all |
Source · 6 lines
def test_test_paths_is_refused_with_a_pointer(tmp_path: Path) -> None:
"""@brief `test_paths:` moved to `tests.paths`."""
with pytest.raises(DeclarationError, match=r"tests\.paths"):
load_declaration(_write(tmp_path, "test_paths: ['t/*']\n"))
Activity · 2 steps
test_the_index_reads_tests_paths
None test_tests_section.test_the_index_reads_tests_paths(Path tmp_path)
`tests.paths` is the index's test scope.
tests/test_tests_section.py:29
Checks
assert "unittests/*" in _test_paths(args, load_declaration(root)).values
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-CONFIG-001 | measured | test_the_index_reads_tests_paths → load_declaration |
| REQ-DDB-CONFIG-006 | measured | test_the_index_reads_tests_paths → _test_paths → resolve_layered |
| REQ-DDB-GUARD-012 | inferred | test_the_index_reads_tests_paths → load_declaration → load_declaration_located → _checked_sections → _checked_section → _checked_requirements → _validate_node |
| REQ-DDB-WIKI-054 | inferred | test_the_index_reads_tests_paths → load_declaration → load_declaration_located → _checked_sections → _checked_section → _checked_list_section → all |
Source · 9 lines
def test_the_index_reads_tests_paths(tmp_path: Path) -> None:
"""@brief `tests.paths` is the index's test scope."""
from clew.cli import _build_argparser, _test_paths
root = _write(tmp_path, "tests:\n paths: ['unittests/*']\n junit: [build/junit.xml]\n")
args = _build_argparser().parse_args(["--output", str(tmp_path / "x.db")])
assert "unittests/*" in _test_paths(args, load_declaration(root)).values
Activity · 4 steps
test_the_wiki_reads_the_same_section
None test_tests_section.test_the_wiki_reads_the_same_section(Path tmp_path)
The wiki's evidence inputs come from top-level `tests:`.
tests/test_tests_section.py:38
Checks
assert not problems, problemsassert config.junit == ("build/junit.xml",)assert config.inputs.contexts == ".coverage"assert config.inputs.layers == (("unit", ("tests/*",)),)
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-GUARD-012 | measured | test_the_wiki_reads_the_same_section → load_wiki_config → _requirements_section → read_requirements_section |
| REQ-DDB-WIKI-054 | inferred | test_the_wiki_reads_the_same_section → load_wiki_config → _comments → all |
Source · 15 lines
def test_the_wiki_reads_the_same_section(tmp_path: Path) -> None:
"""@brief The wiki's evidence inputs come from top-level `tests:`."""
from clew.wiki.config import load_wiki_config
root = _write(
tmp_path,
"tests:\n junit: [build/junit.xml]\n contexts: .coverage\n layers: {unit: ['tests/*']}\n",
)
config, problems = load_wiki_config(root)
assert not problems, problems
assert config.junit == ("build/junit.xml",)
assert config.inputs.contexts == ".coverage"
assert config.inputs.layers == (("unit", ("tests/*",)),)
Activity · 7 steps
test_wiki_tests_is_refused_with_a_pointer
None test_tests_section.test_wiki_tests_is_refused_with_a_pointer(Path tmp_path)
`wiki.tests` moved to the top-level `tests:`.
tests/test_tests_section.py:59
Checks
assert any("top-level `tests:`" in p for p in problems), problems
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-GUARD-012 | measured | test_wiki_tests_is_refused_with_a_pointer → load_wiki_config → _requirements_section → read_requirements_section |
| REQ-DDB-WIKI-054 | inferred | test_wiki_tests_is_refused_with_a_pointer → load_wiki_config → _comments → all |
Source · 8 lines
def test_wiki_tests_is_refused_with_a_pointer(tmp_path: Path) -> None:
"""@brief `wiki.tests` moved to the top-level `tests:`."""
from clew.wiki.config import load_wiki_config
_config, problems = load_wiki_config(_write(tmp_path, "wiki:\n tests: {junit: [j.xml]}\n"))
assert any("top-level `tests:`" in p for p in problems), problems