Skip ssh slsutil tests when system python is below 3.8

This commit is contained in:
Daniel A. Wozniak 2024-08-05 14:24:57 -07:00
parent 539664c6ba
commit cd9753ff0f
2 changed files with 29 additions and 0 deletions

View file

@ -4,9 +4,17 @@ from pathlib import Path
import pytest
from tests.pytests.integration.ssh.test_slsutil import check_system_python_version
from tests.support.helpers import SaltVirtualEnv
from tests.support.pytest.helpers import FakeSaltExtension
pytestmark = [
pytest.mark.skip_unless_on_linux,
pytest.mark.skipif(
not check_system_python_version(), reason="Needs system python >= 3.8"
),
]
@pytest.fixture(scope="module")
def salt_extension(tmp_path_factory):

View file

@ -1,8 +1,29 @@
import json
import subprocess
import packaging
import pytest
def check_system_python_version():
try:
ret = subprocess.run(
["/usr/bin/python3", "--version"], capture_output=True, check=True
)
except FileNotFoundError:
return None
ver = ret.stdout.decode().split(" ", 1)[-1]
return packaging.version.Version(ver) >= packaging.version.Version("3.8")
pytestmark = [
pytest.mark.skip_unless_on_linux,
pytest.mark.skipif(
not check_system_python_version(), reason="Needs system python >= 3.8"
)
]
@pytest.mark.usefixtures("state_tree")
def test_renderer_file(salt_ssh_cli):
ret = salt_ssh_cli.run("slsutil.renderer", "salt://test.sls")