Skip to content

Commit 38791a2

Browse files
committed
review: use UserWarning instead of DeprecationWarning
DeprecationWarning is suppressed by default in Python, so users relying on the old SPECKIT_ALLOW_ALL_TOOLS env var would never see the deprecation notice during normal CLI runs. Switch to UserWarning which is always shown. Update test to also assert the warning category.
1 parent c42e647 commit 38791a2

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

src/specify_cli/integrations/copilot/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def _allow_all() -> bool:
3636
warnings.warn(
3737
"SPECKIT_ALLOW_ALL_TOOLS is deprecated; "
3838
"use SPECKIT_COPILOT_ALLOW_ALL_TOOLS instead.",
39-
DeprecationWarning,
39+
UserWarning,
4040
stacklevel=2,
4141
)
4242
return old_var != "0"

tests/test_workflows.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,11 @@ def test_copilot_deprecated_env_var_still_honoured(self, monkeypatch):
396396
warnings.simplefilter("always")
397397
args = impl.build_exec_args("do stuff")
398398
assert "--yolo" not in args
399-
assert any("SPECKIT_ALLOW_ALL_TOOLS is deprecated" in str(x.message) for x in w)
399+
assert any(
400+
"SPECKIT_ALLOW_ALL_TOOLS is deprecated" in str(x.message)
401+
and issubclass(x.category, UserWarning)
402+
for x in w
403+
)
400404

401405
def test_copilot_new_env_var_takes_precedence(self, monkeypatch):
402406
monkeypatch.setenv("SPECKIT_COPILOT_ALLOW_ALL_TOOLS", "1")

0 commit comments

Comments
 (0)