test: add deprecation warning test for install-service subcommand
- Add test_install_service_subcommand_prints_deprecation_warning to verify that 'muxplex install-service' prints a deprecation warning to stderr containing 'deprecated' and 'muxplex service install' - Update the deprecation warning message in main() to include 'muxplex service install' as the recommended replacement command Refs: task-4
This commit is contained in:
+2
-1
@@ -723,7 +723,8 @@ def main() -> None:
|
||||
import sys
|
||||
|
||||
print(
|
||||
"Warning: 'install-service' is deprecated and will be removed in a future version.",
|
||||
"Warning: 'install-service' is deprecated and will be removed in a future version."
|
||||
" Use 'muxplex service install' instead.",
|
||||
file=sys.stderr,
|
||||
)
|
||||
install_service(system=args.system)
|
||||
|
||||
@@ -969,6 +969,19 @@ def test_main_serve_subcommand_accepts_flags():
|
||||
)
|
||||
|
||||
|
||||
def test_install_service_subcommand_prints_deprecation_warning(capsys):
|
||||
"""'muxplex install-service' must print a deprecation warning to stderr."""
|
||||
from muxplex.cli import main
|
||||
|
||||
with patch("muxplex.cli.install_service"):
|
||||
with patch("sys.argv", ["muxplex", "install-service"]):
|
||||
main()
|
||||
|
||||
captured = capsys.readouterr()
|
||||
assert "deprecated" in captured.err.lower()
|
||||
assert "muxplex service install" in captured.err
|
||||
|
||||
|
||||
def test_help_shows_single_upgrade_line():
|
||||
"""Help output shows 'upgrade (update)' alias notation, not two separate subcommand entries."""
|
||||
import io
|
||||
|
||||
Reference in New Issue
Block a user