Skip to content

Commit b1897ae

Browse files
committed
test(opennebula): remove leftover global assignment in test_find_candidates
When test_find_candidates was refactored from a try/finally pattern to @mock.patch in d482353, the bare global assignment `util.find_devs_with = my_devs_with` was left in by mistake. The try/finally used to save and restore the original; without it, this assignment leaks state and can cause order-dependent failures in other tests. The @mock.patch decorator already patches the function correctly and restores it after the test. Refs GH-6810
1 parent 8029b63 commit b1897ae

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

tests/unittests/sources/test_opennebula.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import pytest
99

10-
from cloudinit import atomic_helper, util
10+
from cloudinit import atomic_helper
1111
from cloudinit.sources import DataSourceOpenNebula as ds
1212
from tests.unittests.helpers import populate_dir
1313

@@ -365,8 +365,6 @@ def my_devs_with(criteria):
365365
}.get(criteria, [])
366366

367367
m_find_devs_with.side_effect = my_devs_with
368-
# Signature of my_devs_with doesn't match util.find_devs_with
369-
util.find_devs_with = my_devs_with # type: ignore[assignment]
370368
assert ["/dev/sdb", "/dev/sr0", "/dev/vdb"] == ds.find_candidate_devs()
371369

372370

0 commit comments

Comments
 (0)