Skip to content

Commit d5295b6

Browse files
kdeldyckeclaude
andcommitted
Fix remaining endswith → in for No-manager-selected checks in tests
Apply the same robustness fix from the backup test to upgrade, restore, and install/remove tests: use `in` instead of `endswith` when checking that the "No manager selected." critical message appears in stderr. At DEBUG verbosity (or if click_extra emits logger-reset messages after exit), additional lines can appear after the critical line and break the endswith assertion. Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 9011cfa commit d5295b6

3 files changed

Lines changed: 8 additions & 4 deletions

File tree

tests/test_cli_install_remove.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,9 @@ def test_single_manager_install_and_remove(self, invoke, manager_id, package_id)
153153

154154
if result.exit_code == 2:
155155
assert not result.stdout
156-
assert result.stderr.endswith(
156+
assert (
157157
"\x1b[31m\x1b[1mcritical\x1b[0m: No manager selected.\n"
158+
in result.stderr
158159
)
159160
else:
160161
assert result.exit_code == 0

tests/test_cli_restore.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,9 @@ def test_single_manager(self, invoke, create_config, manager_id):
9292

9393
if result.exit_code == 2:
9494
assert not result.stdout
95-
assert result.stderr.endswith(
95+
assert (
9696
"\x1b[31m\x1b[1mcritical\x1b[0m: No manager selected.\n"
97+
in result.stderr
9798
)
9899
else:
99100
assert result.exit_code == 0

tests/test_cli_upgrade.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,9 @@ def test_single_manager_dry_run_upgrade_all(self, invoke, manager_id, all_option
8787
assert "assume -A/--all option" in result.stderr
8888
if result.exit_code == 2:
8989
assert not result.stdout
90-
assert result.stderr.endswith(
90+
assert (
9191
"\x1b[31m\x1b[1mcritical\x1b[0m: No manager selected.\n"
92+
in result.stderr
9293
)
9394
else:
9495
assert result.exit_code == 0
@@ -103,8 +104,9 @@ def test_single_manager_upgrade_all(self, invoke, manager_id, all_option):
103104
assert "assume -A/--all option" in result.stderr
104105
if result.exit_code == 2:
105106
assert not result.stdout
106-
assert result.stderr.endswith(
107+
assert (
107108
"\x1b[31m\x1b[1mcritical\x1b[0m: No manager selected.\n"
109+
in result.stderr
108110
)
109111
else:
110112
# Accept exit code 1: see test_all_managers_upgrade_all.

0 commit comments

Comments
 (0)