From 180cfb39513c988b1589222ed4eecd5c437688aa Mon Sep 17 00:00:00 2001 From: holger krekel Date: Thu, 11 Jul 2024 11:49:16 +0200 Subject: [PATCH] get rid of xfailing test --- cmdeploy/src/cmdeploy/cmdeploy.py | 1 + cmdeploy/src/cmdeploy/tests/test_cmdeploy.py | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/cmdeploy/src/cmdeploy/cmdeploy.py b/cmdeploy/src/cmdeploy/cmdeploy.py index bb1bf8f4..aa0a7cdc 100644 --- a/cmdeploy/src/cmdeploy/cmdeploy.py +++ b/cmdeploy/src/cmdeploy/cmdeploy.py @@ -37,6 +37,7 @@ def init_cmd(args, out): mail_domain = args.chatmail_domain if args.inipath.exists(): print(f"Path exists, not modifying: {args.inipath}") + return 1 else: write_initial_config(args.inipath, mail_domain, overrides={}) out.green(f"created config file for {mail_domain} in {args.inipath}") diff --git a/cmdeploy/src/cmdeploy/tests/test_cmdeploy.py b/cmdeploy/src/cmdeploy/tests/test_cmdeploy.py index ff9c5169..3084c8ec 100644 --- a/cmdeploy/src/cmdeploy/tests/test_cmdeploy.py +++ b/cmdeploy/src/cmdeploy/tests/test_cmdeploy.py @@ -21,8 +21,9 @@ class TestCmdline: run = parser.parse_args(["run"]) assert init and run - @pytest.mark.xfail(reason="init doesn't exit anymore, check for CLI output instead") - def test_init_not_overwrite(self): - main(["init", "chat.example.org"]) - with pytest.raises(SystemExit): - main(["init", "chat.example.org"]) + def test_init_not_overwrite(self, capsys): + assert main(["init", "chat.example.org"]) == 0 + capsys.readouterr() + assert main(["init", "chat.example.org"]) == 1 + out, err = capsys.readouterr() + assert "path exists" in out.lower()