test_auto_discovery_ignores_a_mock_config_header¶
Tests › tests/test_preprocessor.py
What this test is for
Why it exists
Many Kconfig projects ship a hand-written mock config header for unit tests. Discovering it would index a configuration NOBODY SHIPS, wearing the authority of a recorded declaration — so no conventional location lies under a test directory, and a `*_config.h` glob (which gh#17 floats) is deliberately absent for the same reason.
Given
root = tmp_path / "repo"(root / "tests" / "include").mkdir(parents=True)
2 more
mock = root / "tests" / "include" / "mock_config.h"mock.write_text("#define MOCK_ONLY 1\n", encoding="utf-8")
When
discovered = resolve_preprocessor( root, {SECTION_PREPROCESSOR: {"config_header": CONFIG_HEADER_AUTO}} )named = resolve_preprocessor( root, {SECTION_PREPROCESSOR: {"config_header": "tests/include/mock_config.h"}} )
Then
- ✓ discovered.macros equals ()
- ✓ named.macros equals ('"MOCK_ONLY=1"',)
tests/test_preprocessor.py:554 · its file's page
What it checks (2)
assert discovered.macros == (), "discovery reached a mock config header"observesresolve_preprocessorviadiscoveredassert named.macros == ('"MOCK_ONLY=1"',), "an explicitly named header must be honoured"observesresolve_preprocessorvianamed
Where the product reaches it
No product flow reaches this code: no product entry point's flow calls any of the functions this test calls.
Call flow
What it reaches
Each row runs from this test, through the calls it makes, to the code a requirement names. If that code breaks, the test's checks are what should catch it. Reaching is not proving: a check only proves what it observes. No mutation records were given, so these rows say what the test REACHES.
Also reaches 2 requirements
Its run touches their code; that is reach, not proof.
- REQ-DDB-CONFIG-004 measured
- REQ-DDB-PIPE-014 measured