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

Show on the map →

Called by none

Calls _write, load_declaration

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-CONFIG-001measuredtest_an_unknown_tests_key_is_refused → load_declaration
REQ-DDB-GUARD-012inferredtest_an_unknown_tests_key_is_refused → load_declaration → load_declaration_located → _checked_sections → _checked_section → _checked_requirements → _validate_node
REQ-DDB-WIKI-054inferredtest_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
lines 69–69with pytest.raises(DeclarationError, match="junti")lines 70–70load_declaration(_write(tmp_path, "tests:\n junti: [j.xml]\n"))

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

Show on the map →

Called by none

Calls _write, load_declaration

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-CONFIG-001measuredtest_test_paths_is_refused_with_a_pointer → load_declaration
REQ-DDB-GUARD-012inferredtest_test_paths_is_refused_with_a_pointer → load_declaration → load_declaration_located → _checked_sections → _checked_section → _checked_requirements → _validate_node
REQ-DDB-WIKI-054inferredtest_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
lines 55–55with pytest.raises(DeclarationError, match=r"tests\.paths")lines 56–56load_declaration(_write(tmp_path, "test_paths: ['t/*']\n"))

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

Show on the map →

Called by none

Calls _build_argparser, _test_paths, _write, load_declaration

Checks

  • assert "unittests/*" in _test_paths(args, load_declaration(root)).values

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-CONFIG-001measuredtest_the_index_reads_tests_paths → load_declaration
REQ-DDB-CONFIG-006measuredtest_the_index_reads_tests_paths → _test_paths → resolve_layered
REQ-DDB-GUARD-012inferredtest_the_index_reads_tests_paths → load_declaration → load_declaration_located → _checked_sections → _checked_section → _checked_requirements → _validate_node
REQ-DDB-WIKI-054inferredtest_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
lines 31–31from clew.cli import _build_argparser, _test_pathslines 33–33root = _write(tmp_path, "tests:\n paths: ['unittests/*']\n junit: [build/junit.xml]\n")lines 34–34args = _build_argparser().parse_args(["--output", str(tmp_path / "x.db")])lines 35–35assert "unittests/*" in _test_paths(args, load_declaration(root)).values

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

Show on the map →

Called by none

Calls _write, load_wiki_config

Checks

  • assert not problems, problems
  • assert config.junit == ("build/junit.xml",)
  • assert config.inputs.contexts == ".coverage"
  • assert config.inputs.layers == (("unit", ("tests/*",)),)

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-012measuredtest_the_wiki_reads_the_same_section → load_wiki_config → _requirements_section → read_requirements_section
REQ-DDB-WIKI-054inferredtest_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
lines 40–40from clew.wiki.config import load_wiki_configlines 42–45root = _write( tmp_path, "tests:\n junit: [build/junit.xml]\n contexts: .coverage\n layers: {unit: ['tests/*']}\n", )lines 46–46config, problems = load_wiki_config(root)lines 47–47assert not problems, problemslines 48–48assert config.junit == ("build/junit.xml",)lines 49–49assert config.inputs.contexts == ".coverage"lines 50–50assert config.inputs.layers == (("unit", ("tests/*",)),)

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

Show on the map →

Called by none

Calls _write, load_wiki_config

Checks

  • assert any("top-level `tests:`" in p for p in problems), problems

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-012measuredtest_wiki_tests_is_refused_with_a_pointer → load_wiki_config → _requirements_section → read_requirements_section
REQ-DDB-WIKI-054inferredtest_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

Activity · 3 steps
lines 61–61from clew.wiki.config import load_wiki_configlines 63–63_config, problems = load_wiki_config(_write(tmp_path, "wiki:\n tests: {junit: [j.xml]}\n"))lines 64–64assert any("top-level `tests:`" in p for p in problems), problems