Skip to content

Commit

Permalink
Isolate navigator from ansible-runner internal warnings (#1537)
Browse files Browse the repository at this point in the history
Related: ansible/ansible-runner#1223
Related: ansible/ansible-runner#1246

Co-authored-by: Bradley A. Thornton <[email protected]>
  • Loading branch information
ssbarnea and cidrblock authored May 19, 2023
1 parent b47752f commit 8e43d29
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,11 @@ enable = [

[tool.pytest.ini_options]
addopts = "-n=auto --dist=loadfile --maxfail=10 --durations=30 --showlocals"
filterwarnings = [
"error",
# https://github.com/ansible/ansible-runner/issues/1246
"ignore::ResourceWarning:ansible_runner",
]

[tool.ruff]
fix = true
Expand Down
9 changes: 8 additions & 1 deletion src/ansible_navigator/runner/ansible_config.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
"""Herein lies the ability for ansible-runner to run the ansible-config command."""
from __future__ import annotations

from ansible_runner import get_ansible_config
import warnings


# Remove this catch-all once newer ansible-runner is released
# https://github.com/ansible/ansible-runner/issues/1223
with warnings.catch_warnings():
warnings.simplefilter("ignore")
from ansible_runner import get_ansible_config

from .base import Base

Expand Down
6 changes: 3 additions & 3 deletions tests/integration/test_stdout_exit_codes.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def id_ee(value: bool):
:param value: The value of the parameter
:returns: The test id
"""
return f"execution_environment={value}"
return "-ee" if value else "-no_ee"


def id_test_data(value: StdoutTest):
Expand All @@ -56,7 +56,7 @@ def id_test_data(value: StdoutTest):
:param value: The value of the parameter
:returns: The test id
"""
return f"action={value.action_name} return={value.return_code}"
return f"{value.action_name}-r{value.return_code}"


class StdoutTest(NamedTuple):
Expand Down Expand Up @@ -129,7 +129,7 @@ class StdoutTest(NamedTuple):

@pytest.mark.parametrize("params", (True, False), indirect=["params"], ids=id_ee)
@pytest.mark.parametrize("test_data", fixture_test_data, ids=id_test_data)
def test(
def test_stdout(
action_run_stdout: type[ActionRunTest],
params: dict[str, Any],
test_data: StdoutTest,
Expand Down

0 comments on commit 8e43d29

Please sign in to comment.