30 lines
1.1 KiB
Python
30 lines
1.1 KiB
Python
"""Tests for warn_deprecated_cwd_env_vars() migration warning."""
|
|
|
|
|
|
class TestDeprecatedCwdWarning:
|
|
"""Warn when MESSAGING_CWD or TERMINAL_CWD is set in .env."""
|
|
|
|
def test_messaging_cwd_triggers_warning(self, monkeypatch, capsys):
|
|
monkeypatch.setenv("MESSAGING_CWD", "/some/path")
|
|
monkeypatch.delenv("TERMINAL_CWD", raising=False)
|
|
|
|
from hermes_cli.config import warn_deprecated_cwd_env_vars
|
|
warn_deprecated_cwd_env_vars(config={})
|
|
|
|
captured = capsys.readouterr()
|
|
assert "MESSAGING_CWD" in captured.err
|
|
assert "deprecated" in captured.err.lower()
|
|
assert "config.yaml" in captured.err
|
|
|
|
|
|
def test_both_deprecated_vars_warn(self, monkeypatch, capsys):
|
|
monkeypatch.setenv("MESSAGING_CWD", "/msg/path")
|
|
monkeypatch.setenv("TERMINAL_CWD", "/term/path")
|
|
|
|
from hermes_cli.config import warn_deprecated_cwd_env_vars
|
|
warn_deprecated_cwd_env_vars(config={})
|
|
|
|
captured = capsys.readouterr()
|
|
assert "MESSAGING_CWD" in captured.err
|
|
assert "TERMINAL_CWD" in captured.err
|