From 2cd50da80d3e300a4c43c4359b1127641075edea Mon Sep 17 00:00:00 2001 From: Quratulain-bilal Date: Sun, 26 Apr 2026 20:49:45 +0500 Subject: [PATCH 1/2] test(presets): silence expected UserWarnings in self-test composition 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 #2363 --- tests/test_presets.py | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/tests/test_presets.py b/tests/test_presets.py index ee4a6dddb1..96d0a80f7b 100644 --- a/tests/test_presets.py +++ b/tests/test_presets.py @@ -1899,8 +1899,20 @@ def test_url_cache_expired(self, project_dir): ] +@pytest.mark.filterwarnings( + r"ignore:Cannot compose command 'speckit\.wrap-test'" +) +@pytest.mark.filterwarnings( + r"ignore:Post-install reconciliation failed for self-test" +) class TestSelfTestPreset: - """Tests using the self-test preset that ships with the repo.""" + """Tests using the self-test preset that ships with the repo. + + The self-test preset ships a wrap-strategy command (``speckit.wrap-test``) + without a corresponding core base layer; reconciliation deliberately + surfaces a UserWarning in that case. The filters above acknowledge those + expected warnings so the suite stays quiet without masking unrelated ones. + """ def test_self_test_preset_exists(self): """Verify the self-test preset directory and manifest exist.""" @@ -2187,8 +2199,19 @@ def test_load_returns_empty_on_invalid_json(self, project_dir): assert load_init_options(project_dir) == {} +@pytest.mark.filterwarnings( + r"ignore:Cannot compose command 'speckit\.wrap-test'" +) +@pytest.mark.filterwarnings( + r"ignore:Post-install reconciliation failed for self-test" +) class TestPresetSkills: - """Tests for preset skill registration and unregistration.""" + """Tests for preset skill registration and unregistration. + + Several tests in this class install the self-test preset, which contains + a wrap-strategy command without a base layer. Reconciliation emits an + expected UserWarning that the filters above acknowledge. + """ def _write_init_options(self, project_dir, ai="claude", ai_skills=True, script="sh"): from specify_cli import save_init_options From 1b8c70ca5f1e97a9c36fe7ece5ada3d1174bd1a8 Mon Sep 17 00:00:00 2001 From: Quratulain-bilal Date: Mon, 27 Apr 2026 18:55:58 +0500 Subject: [PATCH 2/2] test(presets): scope filterwarnings to UserWarning category Address Copilot review on #2373: the previous filterwarnings entries omitted the warning category, so any warning class with a matching message would have been silenced. Append :UserWarning to the four filters so only the deliberately-emitted UserWarnings from _reconcile_composed_commands() are ignored. --- tests/test_presets.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test_presets.py b/tests/test_presets.py index 96d0a80f7b..d70d79858e 100644 --- a/tests/test_presets.py +++ b/tests/test_presets.py @@ -1900,10 +1900,10 @@ def test_url_cache_expired(self, project_dir): @pytest.mark.filterwarnings( - r"ignore:Cannot compose command 'speckit\.wrap-test'" + r"ignore:Cannot compose command 'speckit\.wrap-test':UserWarning" ) @pytest.mark.filterwarnings( - r"ignore:Post-install reconciliation failed for self-test" + r"ignore:Post-install reconciliation failed for self-test:UserWarning" ) class TestSelfTestPreset: """Tests using the self-test preset that ships with the repo. @@ -2200,10 +2200,10 @@ def test_load_returns_empty_on_invalid_json(self, project_dir): @pytest.mark.filterwarnings( - r"ignore:Cannot compose command 'speckit\.wrap-test'" + r"ignore:Cannot compose command 'speckit\.wrap-test':UserWarning" ) @pytest.mark.filterwarnings( - r"ignore:Post-install reconciliation failed for self-test" + r"ignore:Post-install reconciliation failed for self-test:UserWarning" ) class TestPresetSkills: """Tests for preset skill registration and unregistration.