summaryrefslogtreecommitdiff
path: root/tests/integration_tests/conftest.py
diff options
context:
space:
mode:
authorJames Falcon <james.falcon@canonical.com>2022-01-10 16:56:29 -0600
committerGitHub <noreply@github.com>2022-01-10 15:56:29 -0700
commitdc1aabfca851e520693c05322f724bd102c76364 (patch)
tree05c7a0d293b9ddece5671fcdf6a38c59ce776ac8 /tests/integration_tests/conftest.py
parent57ccd89b6af7d3551915df56f548b7617dfcebf9 (diff)
downloadvyos-cloud-init-dc1aabfca851e520693c05322f724bd102c76364.tar.gz
vyos-cloud-init-dc1aabfca851e520693c05322f724bd102c76364.zip
Remove 3.5 and xenial support (SC-711) (#1167)
Includes: - Update tox.ini and .travis.yml accordingly - Cleanup tox.ini with new tox syntax and cloud-init dependencies - Update documentation accordingly - Replace/remove xenial references where additional testing isn't required - Remove xenial checks in integration tests - Replace yield_fixture with fixture in pytest tests Sections of code commented with lines like "Remove when Xenial is no longer supported" still exist as they're require additional testing.
Diffstat (limited to 'tests/integration_tests/conftest.py')
-rw-r--r--tests/integration_tests/conftest.py29
1 files changed, 4 insertions, 25 deletions
diff --git a/tests/integration_tests/conftest.py b/tests/integration_tests/conftest.py
index b14b6ad0..2e44ef29 100644
--- a/tests/integration_tests/conftest.py
+++ b/tests/integration_tests/conftest.py
@@ -45,17 +45,6 @@ os_list = ["ubuntu"]
session_start_time = datetime.datetime.now().strftime("%y%m%d%H%M%S")
-XENIAL_LXD_VM_EXEC_MSG = """\
-The default xenial images do not support `exec` for LXD VMs.
-
-Specify an image known to work using:
-
- OS_IMAGE=<image id>::ubuntu::xenial
-
-You can re-run specifically tests that require this by passing `-m
-lxd_use_exec` to pytest.
-"""
-
def pytest_runtest_setup(item):
"""Skip tests on unsupported clouds.
@@ -101,7 +90,7 @@ def disable_subp_usage(request):
pass
-@pytest.yield_fixture(scope="session")
+@pytest.fixture(scope="session")
def session_cloud():
if integration_settings.PLATFORM not in platforms.keys():
raise ValueError(
@@ -246,16 +235,6 @@ def _client(request, fixture_utils, session_cloud: IntegrationCloud):
if lxd_use_exec is not None:
if not isinstance(session_cloud, _LxdIntegrationCloud):
pytest.skip("lxd_use_exec requires LXD")
- if isinstance(session_cloud, LxdVmCloud):
- image_spec = ImageSpecification.from_os_image()
- if image_spec.release == image_spec.image_id == "xenial":
- # Why fail instead of skip? We expect that skipped tests will
- # be run in a different one of our usual battery of test runs
- # (e.g. LXD-only tests are skipped on EC2 but will run in our
- # normal LXD test runs). This is not true of this test: it
- # can't run in our usual xenial LXD VM test run, and it may not
- # run anywhere else. A failure flags up this discrepancy.
- pytest.fail(XENIAL_LXD_VM_EXEC_MSG)
launch_kwargs["execute_via_ssh"] = False
local_launch_kwargs = {}
if lxd_setup is not None:
@@ -276,21 +255,21 @@ def _client(request, fixture_utils, session_cloud: IntegrationCloud):
_collect_logs(instance, request.node.nodeid, test_failed)
-@pytest.yield_fixture
+@pytest.fixture
def client(request, fixture_utils, session_cloud, setup_image):
"""Provide a client that runs for every test."""
with _client(request, fixture_utils, session_cloud) as client:
yield client
-@pytest.yield_fixture(scope="module")
+@pytest.fixture(scope="module")
def module_client(request, fixture_utils, session_cloud, setup_image):
"""Provide a client that runs once per module."""
with _client(request, fixture_utils, session_cloud) as client:
yield client
-@pytest.yield_fixture(scope="class")
+@pytest.fixture(scope="class")
def class_client(request, fixture_utils, session_cloud, setup_image):
"""Provide a client that runs once per class."""
with _client(request, fixture_utils, session_cloud) as client: