File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -35,8 +35,8 @@ def resolve_default_init_integration() -> str:
3535 (``SPECKIT_INTEGRATION_DEFAULT``). When it names a registered integration
3636 key, that key is returned; otherwise the hardcoded
3737 :data:`DEFAULT_INIT_INTEGRATION` (``"copilot"``) is used. An invalid value
38- emits a warning to stderr rather than silently falling back, so operators
39- can tell a typo from an intentional default.
38+ emits a warning through the ``logging`` module rather than silently
39+ falling back, so operators can tell a typo from an intentional default.
4040 """
4141 override = (os .environ .get (DEFAULT_INIT_INTEGRATION_ENV_VAR ) or "" ).strip ()
4242 if not override :
Original file line number Diff line number Diff line change @@ -81,18 +81,21 @@ def test_resolve_default_init_integration_whitespace_trimmed(monkeypatch):
8181
8282
8383def test_resolve_default_init_integration_invalid_warns_and_falls_back (
84- monkeypatch , capsys
84+ monkeypatch , caplog
8585):
86+ import logging
87+
8688 from specify_cli ._agent_config import (
8789 DEFAULT_INIT_INTEGRATION ,
8890 DEFAULT_INIT_INTEGRATION_ENV_VAR ,
8991 resolve_default_init_integration ,
9092 )
9193 monkeypatch .setenv (DEFAULT_INIT_INTEGRATION_ENV_VAR , "not-a-real-agent" )
92- assert resolve_default_init_integration () == DEFAULT_INIT_INTEGRATION
93- captured = capsys .readouterr ()
94- assert "not-a-real-agent" in captured .err
95- assert DEFAULT_INIT_INTEGRATION_ENV_VAR in captured .err
94+ with caplog .at_level (logging .WARNING ):
95+ assert resolve_default_init_integration () == DEFAULT_INIT_INTEGRATION
96+ messages = [record .getMessage () for record in caplog .records ]
97+ assert any ("not-a-real-agent" in message for message in messages )
98+ assert any (DEFAULT_INIT_INTEGRATION_ENV_VAR in message for message in messages )
9699
97100
98101def test_resolve_default_init_integration_re_exported_from_init ():
You can’t perform that action at this time.
0 commit comments