Skip to content

Commit

Permalink
FIX: ignoring has_kuadrant() check when --setup-plan option is used
Browse files Browse the repository at this point in the history
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 #618

Signed-off-by: Zdenek Kraus <[email protected]>
  • Loading branch information
zkraus committed Jan 16, 2025
1 parent cab5452 commit de3471c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions testsuite/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit de3471c

Please sign in to comment.