summaryrefslogtreecommitdiff
path: root/tests/unittests
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unittests')
-rw-r--r--tests/unittests/cmd/devel/test_hotplug_hook.py2
-rw-r--r--tests/unittests/config/test_cc_install_hotplug.py2
-rw-r--r--tests/unittests/distros/test_networking.py4
-rw-r--r--tests/unittests/sources/test_lxd.py2
-rw-r--r--tests/unittests/sources/test_oracle.py4
-rw-r--r--tests/unittests/sources/test_vmware.py2
-rw-r--r--tests/unittests/test_features.py2
-rw-r--r--tests/unittests/test_net_activators.py4
-rw-r--r--tests/unittests/test_stages.py2
-rw-r--r--tests/unittests/test_util.py2
10 files changed, 13 insertions, 13 deletions
diff --git a/tests/unittests/cmd/devel/test_hotplug_hook.py b/tests/unittests/cmd/devel/test_hotplug_hook.py
index 842e8dfd..5ecb5969 100644
--- a/tests/unittests/cmd/devel/test_hotplug_hook.py
+++ b/tests/unittests/cmd/devel/test_hotplug_hook.py
@@ -16,7 +16,7 @@ hotplug_args = namedtuple("hotplug_args", "udevaction, subsystem, devpath")
FAKE_MAC = "11:22:33:44:55:66"
-@pytest.yield_fixture
+@pytest.fixture
def mocks():
m_init = mock.MagicMock(spec=Init)
m_distro = mock.MagicMock(spec=Distro)
diff --git a/tests/unittests/config/test_cc_install_hotplug.py b/tests/unittests/config/test_cc_install_hotplug.py
index 3bd44aba..e67fce60 100644
--- a/tests/unittests/config/test_cc_install_hotplug.py
+++ b/tests/unittests/config/test_cc_install_hotplug.py
@@ -12,7 +12,7 @@ from cloudinit.config.cc_install_hotplug import (
from cloudinit.event import EventScope, EventType
-@pytest.yield_fixture()
+@pytest.fixture()
def mocks():
m_update_enabled = mock.patch("cloudinit.stages.update_event_enabled")
m_write = mock.patch("cloudinit.util.write_file", autospec=True)
diff --git a/tests/unittests/distros/test_networking.py b/tests/unittests/distros/test_networking.py
index 635f6901..274647cb 100644
--- a/tests/unittests/distros/test_networking.py
+++ b/tests/unittests/distros/test_networking.py
@@ -13,7 +13,7 @@ from cloudinit.distros.networking import (
)
-@pytest.yield_fixture
+@pytest.fixture
def generic_networking_cls():
"""Returns a direct Networking subclass which errors on /sys usage.
@@ -40,7 +40,7 @@ def generic_networking_cls():
yield TestNetworking
-@pytest.yield_fixture
+@pytest.fixture
def sys_class_net(tmpdir):
sys_class_net_path = tmpdir.join("sys/class/net")
sys_class_net_path.ensure_dir()
diff --git a/tests/unittests/sources/test_lxd.py b/tests/unittests/sources/test_lxd.py
index ad1508a0..e11c3746 100644
--- a/tests/unittests/sources/test_lxd.py
+++ b/tests/unittests/sources/test_lxd.py
@@ -57,7 +57,7 @@ def lxd_metadata():
return LXD_V1_METADATA
-@pytest.yield_fixture
+@pytest.fixture
def lxd_ds(request, paths, lxd_metadata):
"""
Return an instantiated DataSourceLXD.
diff --git a/tests/unittests/sources/test_oracle.py b/tests/unittests/sources/test_oracle.py
index e0e79c8c..356b3738 100644
--- a/tests/unittests/sources/test_oracle.py
+++ b/tests/unittests/sources/test_oracle.py
@@ -93,7 +93,7 @@ def metadata_version():
return 2
-@pytest.yield_fixture
+@pytest.fixture
def oracle_ds(request, fixture_utils, paths, metadata_version):
"""
Return an instantiated DataSourceOracle.
@@ -649,7 +649,7 @@ class TestCommon_GetDataBehaviour:
separate class for that case.)
"""
- @pytest.yield_fixture(params=[True, False])
+ @pytest.fixture(params=[True, False])
def parameterized_oracle_ds(self, request, oracle_ds):
"""oracle_ds parameterized for iSCSI and non-iSCSI root respectively"""
is_iscsi_root = request.param
diff --git a/tests/unittests/sources/test_vmware.py b/tests/unittests/sources/test_vmware.py
index dcdbda89..dd331349 100644
--- a/tests/unittests/sources/test_vmware.py
+++ b/tests/unittests/sources/test_vmware.py
@@ -57,7 +57,7 @@ runcmd:
"""
-@pytest.yield_fixture(autouse=True)
+@pytest.fixture(autouse=True)
def common_patches():
with mock.patch("cloudinit.util.platform.platform", return_value="Linux"):
with mock.patch.multiple(
diff --git a/tests/unittests/test_features.py b/tests/unittests/test_features.py
index 141de55b..794a9654 100644
--- a/tests/unittests/test_features.py
+++ b/tests/unittests/test_features.py
@@ -12,7 +12,7 @@ import pytest
import cloudinit
-@pytest.yield_fixture()
+@pytest.fixture()
def create_override(request):
"""
Create a feature overrides file and do some module wizardry to make
diff --git a/tests/unittests/test_net_activators.py b/tests/unittests/test_net_activators.py
index 0e3ab43f..3c29e2f7 100644
--- a/tests/unittests/test_net_activators.py
+++ b/tests/unittests/test_net_activators.py
@@ -39,7 +39,7 @@ NETPLAN_CALL_LIST = [
]
-@pytest.yield_fixture
+@pytest.fixture
def available_mocks():
mocks = namedtuple("Mocks", "m_which, m_file")
with patch("cloudinit.subp.which", return_value=True) as m_which:
@@ -47,7 +47,7 @@ def available_mocks():
yield mocks(m_which, m_file)
-@pytest.yield_fixture
+@pytest.fixture
def unavailable_mocks():
mocks = namedtuple("Mocks", "m_which, m_file")
with patch("cloudinit.subp.which", return_value=False) as m_which:
diff --git a/tests/unittests/test_stages.py b/tests/unittests/test_stages.py
index be1a0787..3214410b 100644
--- a/tests/unittests/test_stages.py
+++ b/tests/unittests/test_stages.py
@@ -512,7 +512,7 @@ class TestInit_InitializeFilesystem:
TODO: Expand these tests to cover all of _initialize_filesystem's behavior.
"""
- @pytest.yield_fixture
+ @pytest.fixture
def init(self, paths):
"""A fixture which yields a stages.Init instance with paths and cfg set
diff --git a/tests/unittests/test_util.py b/tests/unittests/test_util.py
index e2bfe9d2..3765511b 100644
--- a/tests/unittests/test_util.py
+++ b/tests/unittests/test_util.py
@@ -1127,7 +1127,7 @@ class TestMountCb:
TODO: Test the if/else branch that actually performs the mounting operation
"""
- @pytest.yield_fixture
+ @pytest.fixture
def already_mounted_device_and_mountdict(self):
"""Mock an already-mounted device, and yield (device, mount dict)"""
device = "/dev/fake0"