From de3471c7397556e295aa18f1a47510afb5f9a5cf Mon Sep 17 00:00:00 2001 From: Zdenek Kraus Date: Thu, 16 Jan 2025 17:24:19 +0100 Subject: [PATCH] FIX: ignoring has_kuadrant() check when --setup-plan option is used When using --setup-plan to print out a "tesplan", `pytest_runtest_setup` uses `has_kuadrant()` check that might fail when oc client is not installed. Adding the condition when --setup-plan is used to skip any checks. fixes Kuadrant/testsuite#618 Signed-off-by: Zdenek Kraus --- testsuite/tests/conftest.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/testsuite/tests/conftest.py b/testsuite/tests/conftest.py index a2f84422..84f27a3f 100644 --- a/testsuite/tests/conftest.py +++ b/testsuite/tests/conftest.py @@ -37,6 +37,11 @@ def pytest_runtest_setup(item): (https://docs.pytest.org/en/latest/example/markers.html#marking-test-functions-and-selecting-them-for-a-run) In this function we skip or fail the tests that were selected but their capabilities are not available """ + # prevents ERROR OpenShiftPythonException due to oc and kuadrant not being set-up + # when just printing setup plan + # error is raised during has_kuadrant() + if item.config.getoption("--setup-plan"): + return marks = [i.name for i in item.iter_markers()] skip_or_fail = pytest.fail if item.config.getoption("--enforce") else pytest.skip standalone = item.config.getoption("--standalone")