close
Skip to content

test(presets): silence expected UserWarnings in self-test composition…#2373

Open
Quratulain-bilal wants to merge 1 commit intogithub:mainfrom
Quratulain-bilal:fix/preset-test-warnings
Open

test(presets): silence expected UserWarnings in self-test composition…#2373
Quratulain-bilal wants to merge 1 commit intogithub:mainfrom
Quratulain-bilal:fix/preset-test-warnings

Conversation

@Quratulain-bilal
Copy link
Copy Markdown
Contributor

@Quratulain-bilal Quratulain-bilal commented Apr 26, 2026

Summary

Fixes #2363tests/test_presets.py produces 18 unhandled UserWarnings when the self-test preset is installed during
tests.

Root cause

The repo's presets/self-test/ preset provides speckit.wrap-test, a wrap-strategy command intentionally without a
base layer
to exercise that code path. _reconcile_composed_commands() in presets.py:786 deliberately emits
UserWarning("Cannot compose command 'speckit.wrap-test': no base layer...") and a follow-up "Post-install reconciliation failed..." warning — these are expected for this fixture but were not acknowledged at the test level.

Fix

Per the issue's option #2, add @pytest.mark.filterwarnings(...) decorators on TestSelfTestPreset and
TestPresetSkills for the two known messages. Other UserWarning sources still propagate normally so future
regressions remain visible.

Verification

pytest tests/test_presets.py::TestSelfTestPreset tests/test_presets.py::TestPresetSkills -W error::UserWarning
# 36 passed
pytest tests/test_presets.py
# 241 passed

Test plan

- Targeted tests pass under -W error::UserWarning
- Full tests/test_presets.py suite passes (241/241)
- CI green

… tests

The self-test preset that ships with the repo provides a wrap-strategy
command (speckit.wrap-test) intentionally without a corresponding core
base layer, exercising the 'no base layer' branch of
_reconcile_composed_commands().

Eighteen tests across TestSelfTestPreset and TestPresetSkills install
this preset and trigger an expected UserWarning. Running the suite with
-W error::UserWarning surfaces them as test noise that could obscure
unrelated warnings.

Add class-level pytest.mark.filterwarnings filters to acknowledge the
two known messages ('Cannot compose command speckit.wrap-test' and
'Post-install reconciliation failed for self-test') so other UserWarning
sources still propagate normally.

Fixes github#2363
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.

test(presets): 18 unhandled UserWarnings in composition tests

1 participant