diff --git a/tests/conftest.py b/tests/conftest.py index 459eaa3f267..6c6317d1f15 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -8585,21 +8585,24 @@ def setup_cnv(request): """ cnv_obj = CNVInstaller() installed = False - if not cnv_obj.post_install_verification(): - installed = True - cnv_obj.deploy_cnv() + try: + if not cnv_obj.post_install_verification(): + installed = True + cnv_obj.deploy_cnv() - def finalizer(): - """ - Clean up CNV deployment + finally: - """ + def finalizer(): + """ + Clean up CNV deployment - # Uninstall CNV only if installed by this fixture - if installed: - cnv_obj.uninstall_cnv() + """ - request.addfinalizer(finalizer) + # Uninstall CNV only if installed by this fixture + if installed: + cnv_obj.uninstall_cnv() + + request.addfinalizer(finalizer) @pytest.fixture(scope="class")