Skip to content

Commit 2284ed3

Browse files
committed
Fix test_add_anod_action2_force_install
This test checked for the generation of an exception, but was considered OK if the exception was not generated.
1 parent 9735b5c commit 2284ed3

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

tests/tests_e3/anod/context_test.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -103,19 +103,19 @@ def test_add_anod_action2(self):
103103
def test_add_anod_action2_force_install(self):
104104
"""Check that forcing an install with no package is rejected."""
105105
ac = self.create_context()
106-
try:
106+
with pytest.raises(SchedulingError) as err:
107107
ac.add_anod_action(
108108
"spec2",
109109
env=ac.default_env,
110110
primitive="install",
111111
plan_args={},
112112
plan_line="install_plan.txt:2",
113113
)
114-
except SchedulingError as err:
115-
assert (
116-
"error in plan at install_plan.txt:2: install should "
117-
"be replaced by build" in str(err)
118-
)
114+
115+
assert (
116+
"error in plan at install_plan.txt:2: install should be replaced by build"
117+
in str(err)
118+
)
119119

120120
def test_add_anod_action2_no_source_resolver(self):
121121
def no_resolver(action, decision):
@@ -637,7 +637,6 @@ def anod_action(
637637
myplan.load("plan.plan")
638638

639639
if not reject_duplicates:
640-
# Execute the plan and create anod actions
641640
# Execute the plan and create anod actions
642641
for action in cm.execute(myplan, "myserver"):
643642
ac.add_plan_action(action)

0 commit comments

Comments
 (0)