diff --git a/tests/integration/cli/test_custom_module.py b/tests/integration/cli/test_custom_module.py index f603a372907..53f3d726914 100644 --- a/tests/integration/cli/test_custom_module.py +++ b/tests/integration/cli/test_custom_module.py @@ -45,7 +45,7 @@ pytestmark = [ # backports.ssl-match-hostname which is not installed on the system. ), pytest.mark.skipif( - not check_system_python_version(), reason="Needs system python >= 3.8" + not check_system_python_version(), reason="Needs system python >= 3.9" ), ] diff --git a/tests/integration/ssh/test_state.py b/tests/integration/ssh/test_state.py index 21896cff29c..36449460699 100644 --- a/tests/integration/ssh/test_state.py +++ b/tests/integration/ssh/test_state.py @@ -8,7 +8,7 @@ import time import pytest from saltfactories.utils.tempfiles import temp_file -from tests.pytests.integration.ssh.test_slsutil import check_system_python_version +from tests.pytests.integration.ssh import check_system_python_version from tests.support.case import SSHCase from tests.support.runtests import RUNTIME_VARS @@ -24,7 +24,7 @@ pytestmark = [ # backports.ssl-match-hostname which is not installed on the system. ), pytest.mark.skipif( - not check_system_python_version(), reason="Needs system python >= 3.8" + not check_system_python_version(), reason="Needs system python >= 3.9" ), ] diff --git a/tests/pytests/integration/netapi/test_ssh_client.py b/tests/pytests/integration/netapi/test_ssh_client.py index 09bd51dc989..a7a6f333e76 100644 --- a/tests/pytests/integration/netapi/test_ssh_client.py +++ b/tests/pytests/integration/netapi/test_ssh_client.py @@ -4,6 +4,7 @@ import pytest import salt.netapi from salt.exceptions import EauthAuthenticationError, SaltInvocationError +from tests.pytests.integration.ssh import check_system_python_version from tests.support.helpers import SaveRequestsPostHandler, Webserver from tests.support.mock import patch @@ -19,6 +20,9 @@ pytestmark = [ # backports.ssl-match-hostname which is not installed on the system. ), pytest.mark.timeout_unless_on_windows(120), + pytest.mark.skipif( + not check_system_python_version(), reason="Needs system python >= 3.9" + ), ] log = logging.getLogger(__name__) diff --git a/tests/pytests/integration/pillar/test_httpclient_in_pillar.py b/tests/pytests/integration/pillar/test_httpclient_in_pillar.py index 666e51de52c..f5d39697a5f 100644 --- a/tests/pytests/integration/pillar/test_httpclient_in_pillar.py +++ b/tests/pytests/integration/pillar/test_httpclient_in_pillar.py @@ -1,3 +1,14 @@ +import pytest + +from tests.pytests.integration.ssh import check_system_python_version + +pytestmark = [ + pytest.mark.skipif( + not check_system_python_version(), reason="Needs system python >= 3.9" + ), +] + + def test_pillar_using_http_query(salt_master, salt_minion, salt_cli, tmp_path): pillar_top = """ base: diff --git a/tests/pytests/integration/ssh/__init__.py b/tests/pytests/integration/ssh/__init__.py index e69de29bb2d..199aa1c116b 100644 --- a/tests/pytests/integration/ssh/__init__.py +++ b/tests/pytests/integration/ssh/__init__.py @@ -0,0 +1,17 @@ +import subprocess + +import packaging + + +def check_system_python_version(): + """ + Validate the system python version is greater than 3.9 + """ + 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.9") diff --git a/tests/pytests/integration/ssh/state/test_parallel.py b/tests/pytests/integration/ssh/state/test_parallel.py index 8ff9d7db139..dc1f56472e0 100644 --- a/tests/pytests/integration/ssh/state/test_parallel.py +++ b/tests/pytests/integration/ssh/state/test_parallel.py @@ -4,9 +4,14 @@ Verify salt-ssh states support ``parallel``. import pytest +from tests.pytests.integration.ssh import check_system_python_version + pytestmark = [ pytest.mark.skip_on_windows(reason="salt-ssh not available on Windows"), pytest.mark.slow_test, + pytest.mark.skipif( + not check_system_python_version(), reason="Needs system python >= 3.9" + ), ] diff --git a/tests/pytests/integration/ssh/state/test_pillar_override.py b/tests/pytests/integration/ssh/state/test_pillar_override.py index c7f49b2b816..475467d60e2 100644 --- a/tests/pytests/integration/ssh/state/test_pillar_override.py +++ b/tests/pytests/integration/ssh/state/test_pillar_override.py @@ -9,11 +9,15 @@ import json import pytest import salt.utils.dictupdate +from tests.pytests.integration.ssh import check_system_python_version pytestmark = [ pytest.mark.skip_on_windows(reason="salt-ssh not available on Windows"), pytest.mark.usefixtures("pillar_tree_nested"), pytest.mark.slow_test, + pytest.mark.skipif( + not check_system_python_version(), reason="Needs system python >= 3.9" + ), ] diff --git a/tests/pytests/integration/ssh/state/test_retcode_pillar_render_exception.py b/tests/pytests/integration/ssh/state/test_retcode_pillar_render_exception.py index 92cd56dbb39..1ad8bd4a53b 100644 --- a/tests/pytests/integration/ssh/state/test_retcode_pillar_render_exception.py +++ b/tests/pytests/integration/ssh/state/test_retcode_pillar_render_exception.py @@ -5,10 +5,14 @@ Verify salt-ssh fails with a retcode > 0 when a pillar rendering fails. import pytest from salt.defaults.exitcodes import EX_AGGREGATE +from tests.pytests.integration.ssh import check_system_python_version pytestmark = [ pytest.mark.skip_on_windows(reason="salt-ssh not available on Windows"), pytest.mark.slow_test, + pytest.mark.skipif( + not check_system_python_version(), reason="Needs system python >= 3.9" + ), ] diff --git a/tests/pytests/integration/ssh/state/test_retcode_render_exception.py b/tests/pytests/integration/ssh/state/test_retcode_render_exception.py index 5291e107b91..5a89a62dea3 100644 --- a/tests/pytests/integration/ssh/state/test_retcode_render_exception.py +++ b/tests/pytests/integration/ssh/state/test_retcode_render_exception.py @@ -5,10 +5,14 @@ Verify salt-ssh fails with a retcode > 0 when a state rendering fails. import pytest from salt.defaults.exitcodes import EX_AGGREGATE +from tests.pytests.integration.ssh import check_system_python_version pytestmark = [ pytest.mark.skip_on_windows(reason="salt-ssh not available on Windows"), pytest.mark.slow_test, + pytest.mark.skipif( + not check_system_python_version(), reason="Needs system python >= 3.9" + ), ] diff --git a/tests/pytests/integration/ssh/state/test_retcode_render_module_exception.py b/tests/pytests/integration/ssh/state/test_retcode_render_module_exception.py index 7125485a69b..f71f5e0664c 100644 --- a/tests/pytests/integration/ssh/state/test_retcode_render_module_exception.py +++ b/tests/pytests/integration/ssh/state/test_retcode_render_module_exception.py @@ -6,10 +6,14 @@ when a state rendering fails because an execution module throws an exception. import pytest from salt.defaults.exitcodes import EX_AGGREGATE +from tests.pytests.integration.ssh import check_system_python_version pytestmark = [ pytest.mark.skip_on_windows(reason="salt-ssh not available on Windows"), pytest.mark.slow_test, + pytest.mark.skipif( + not check_system_python_version(), reason="Needs system python >= 3.9" + ), ] diff --git a/tests/pytests/integration/ssh/state/test_retcode_run_fail.py b/tests/pytests/integration/ssh/state/test_retcode_run_fail.py index cb784ffb306..756f387d43d 100644 --- a/tests/pytests/integration/ssh/state/test_retcode_run_fail.py +++ b/tests/pytests/integration/ssh/state/test_retcode_run_fail.py @@ -5,10 +5,14 @@ Verify salt-ssh passes on a failing retcode from state execution. import pytest from salt.defaults.exitcodes import EX_AGGREGATE +from tests.pytests.integration.ssh import check_system_python_version pytestmark = [ pytest.mark.skip_on_windows(reason="salt-ssh not available on Windows"), pytest.mark.slow_test, + pytest.mark.skipif( + not check_system_python_version(), reason="Needs system python >= 3.9" + ), ] diff --git a/tests/pytests/integration/ssh/test_cp.py b/tests/pytests/integration/ssh/test_cp.py index 8fddb7bd73d..9fca42fbfb7 100644 --- a/tests/pytests/integration/ssh/test_cp.py +++ b/tests/pytests/integration/ssh/test_cp.py @@ -6,11 +6,15 @@ from pathlib import Path import pytest from saltfactories.utils import random_string +from tests.pytests.integration.ssh import check_system_python_version from tests.support.runtests import RUNTIME_VARS pytestmark = [ pytest.mark.slow_test, pytest.mark.skip_on_windows(reason="salt-ssh not available on Windows"), + pytest.mark.skipif( + not check_system_python_version(), reason="Needs system python >= 3.9" + ), ] diff --git a/tests/pytests/integration/ssh/test_deploy.py b/tests/pytests/integration/ssh/test_deploy.py index 37bdd416758..1d61d05b731 100644 --- a/tests/pytests/integration/ssh/test_deploy.py +++ b/tests/pytests/integration/ssh/test_deploy.py @@ -10,10 +10,14 @@ import pytest import salt.utils.files import salt.utils.yaml from salt.defaults.exitcodes import EX_AGGREGATE +from tests.pytests.integration.ssh import check_system_python_version pytestmark = [ pytest.mark.slow_test, pytest.mark.skip_on_windows(reason="salt-ssh not available on Windows"), + pytest.mark.skipif( + not check_system_python_version(), reason="Needs system python >= 3.9" + ), ] @@ -163,28 +167,6 @@ def test_thin_dir(salt_ssh_cli): assert thin_dir.joinpath("running_data").exists() -def test_relenv_dir(salt_ssh_cli): - """ - test to make sure thin_dir is created - and salt-call file is included - """ - ret = salt_ssh_cli.run("--relenv", "config.get", "thin_dir") - assert ret.returncode == 0 - thin_dir = pathlib.Path(ret.data) - assert thin_dir.is_dir() - assert thin_dir - assert thin_dir.joinpath("salt-call").exists() - - -def test_relenv_ping(salt_ssh_cli): - """ - Test a simple ping - """ - ret = salt_ssh_cli.run("--relenv", "test.ping") - assert ret.returncode == 0 - assert ret.data is True - - def test_wipe(salt_ssh_cli): """ Ensure --wipe is respected by the state module wrapper diff --git a/tests/pytests/integration/ssh/test_deploy_relenv.py b/tests/pytests/integration/ssh/test_deploy_relenv.py new file mode 100644 index 00000000000..6db9ac051de --- /dev/null +++ b/tests/pytests/integration/ssh/test_deploy_relenv.py @@ -0,0 +1,34 @@ +""" +salt-ssh testing +""" + +import pathlib + +import pytest + +pytestmark = [ + pytest.mark.slow_test, + pytest.mark.skip_on_windows(reason="salt-ssh not available on Windows"), +] + + +def test_relenv_dir(salt_ssh_cli): + """ + test to make sure thin_dir is created + and salt-call file is included + """ + ret = salt_ssh_cli.run("--relenv", "config.get", "thin_dir") + assert ret.returncode == 0 + thin_dir = pathlib.Path(ret.data) + assert thin_dir.is_dir() + assert thin_dir + assert thin_dir.joinpath("salt-call").exists() + + +def test_relenv_ping(salt_ssh_cli): + """ + Test a simple ping + """ + ret = salt_ssh_cli.run("--relenv", "test.ping") + assert ret.returncode == 0 + assert ret.data is True diff --git a/tests/pytests/integration/ssh/test_grains.py b/tests/pytests/integration/ssh/test_grains.py index acb319bc551..47877d68b2d 100644 --- a/tests/pytests/integration/ssh/test_grains.py +++ b/tests/pytests/integration/ssh/test_grains.py @@ -1,10 +1,14 @@ import pytest import salt.utils.platform +from tests.pytests.integration.ssh import check_system_python_version pytestmark = [ pytest.mark.slow_test, pytest.mark.skip_on_windows(reason="salt-ssh not available on Windows"), + pytest.mark.skipif( + not check_system_python_version(), reason="Needs system python >= 3.9" + ), ] diff --git a/tests/pytests/integration/ssh/test_jinja_filters.py b/tests/pytests/integration/ssh/test_jinja_filters.py index 7b55384a2f4..46d7d8fbe76 100644 --- a/tests/pytests/integration/ssh/test_jinja_filters.py +++ b/tests/pytests/integration/ssh/test_jinja_filters.py @@ -1,9 +1,14 @@ import pytest from saltfactories.utils.functional import StateResult +from tests.pytests.integration.ssh import check_system_python_version + pytestmark = [ pytest.mark.slow_test, pytest.mark.skip_on_windows(reason="salt-ssh not available on Windows"), + pytest.mark.skipif( + not check_system_python_version(), reason="Needs system python >= 3.9" + ), ] diff --git a/tests/pytests/integration/ssh/test_jinja_mods.py b/tests/pytests/integration/ssh/test_jinja_mods.py index f0bd7c508f4..7caef9f7775 100644 --- a/tests/pytests/integration/ssh/test_jinja_mods.py +++ b/tests/pytests/integration/ssh/test_jinja_mods.py @@ -1,8 +1,13 @@ import pytest from saltfactories.utils.functional import StateResult +from tests.pytests.integration.ssh import check_system_python_version + pytestmark = [ pytest.mark.skip_on_windows(reason="salt-ssh not available on Windows"), + pytest.mark.skipif( + not check_system_python_version(), reason="Needs system python >= 3.9" + ), ] diff --git a/tests/pytests/integration/ssh/test_master.py b/tests/pytests/integration/ssh/test_master.py index 8b566756c55..fcc86976726 100644 --- a/tests/pytests/integration/ssh/test_master.py +++ b/tests/pytests/integration/ssh/test_master.py @@ -10,10 +10,14 @@ from saltfactories.utils.functional import StateResult import salt.utils.platform import salt.utils.versions +from tests.pytests.integration.ssh import check_system_python_version pytestmark = [ pytest.mark.slow_test, pytest.mark.skip_on_windows(reason="salt-ssh not available on Windows"), + pytest.mark.skipif( + not check_system_python_version(), reason="Needs system python >= 3.9" + ), ] diff --git a/tests/pytests/integration/ssh/test_mine.py b/tests/pytests/integration/ssh/test_mine.py index 19e57c5ecbb..28bc7677fd6 100644 --- a/tests/pytests/integration/ssh/test_mine.py +++ b/tests/pytests/integration/ssh/test_mine.py @@ -2,9 +2,14 @@ import shutil import pytest +from tests.pytests.integration.ssh import check_system_python_version + pytestmark = [ pytest.mark.slow_test, pytest.mark.skip_on_windows(reason="salt-ssh not available on Windows"), + pytest.mark.skipif( + not check_system_python_version(), reason="Needs system python >= 3.9" + ), ] diff --git a/tests/pytests/integration/ssh/test_pillar.py b/tests/pytests/integration/ssh/test_pillar.py index 42c6ad33e1a..0d71be5d4f5 100644 --- a/tests/pytests/integration/ssh/test_pillar.py +++ b/tests/pytests/integration/ssh/test_pillar.py @@ -1,8 +1,13 @@ import pytest +from tests.pytests.integration.ssh import check_system_python_version + pytestmark = [ pytest.mark.skip_on_windows(reason="salt-ssh not available on Windows"), pytest.mark.slow_test, + pytest.mark.skipif( + not check_system_python_version(), reason="Needs system python >= 3.9" + ), ] diff --git a/tests/pytests/integration/ssh/test_pillar_compilation.py b/tests/pytests/integration/ssh/test_pillar_compilation.py index d864edeab6d..9c60d4399b2 100644 --- a/tests/pytests/integration/ssh/test_pillar_compilation.py +++ b/tests/pytests/integration/ssh/test_pillar_compilation.py @@ -7,8 +7,15 @@ import textwrap import pytest from pytestshellutils.utils.processes import ProcessResult +from tests.pytests.integration.ssh import check_system_python_version + log = logging.getLogger(__name__) +pytestmark = [ + pytest.mark.skipif( + not check_system_python_version(), reason="Needs system python >= 3.9" + ), +] # The following fixtures are copied from pytests/functional/pillar/test_gpg.py diff --git a/tests/pytests/integration/ssh/test_pre_flight.py b/tests/pytests/integration/ssh/test_pre_flight.py index 7dc56f37535..716e948aec1 100644 --- a/tests/pytests/integration/ssh/test_pre_flight.py +++ b/tests/pytests/integration/ssh/test_pre_flight.py @@ -18,9 +18,13 @@ import yaml from saltfactories.utils import random_string import salt.utils.files +from tests.pytests.integration.ssh import check_system_python_version pytestmark = [ pytest.mark.skip_on_windows(reason="Salt-ssh not available on Windows"), + pytest.mark.skipif( + not check_system_python_version(), reason="Needs system python >= 3.9" + ), ] diff --git a/tests/pytests/integration/ssh/test_publish.py b/tests/pytests/integration/ssh/test_publish.py index 4ecfaeb349a..42070fd3776 100644 --- a/tests/pytests/integration/ssh/test_publish.py +++ b/tests/pytests/integration/ssh/test_publish.py @@ -1,8 +1,13 @@ import pytest +from tests.pytests.integration.ssh import check_system_python_version + pytestmark = [ pytest.mark.slow_test, pytest.mark.skip_on_windows(reason="salt-ssh not available on Windows"), + pytest.mark.skipif( + not check_system_python_version(), reason="Needs system python >= 3.9" + ), ] diff --git a/tests/pytests/integration/ssh/test_saltcheck.py b/tests/pytests/integration/ssh/test_saltcheck.py index a19fe9f1270..58755642a5c 100644 --- a/tests/pytests/integration/ssh/test_saltcheck.py +++ b/tests/pytests/integration/ssh/test_saltcheck.py @@ -1,8 +1,13 @@ import pytest +from tests.pytests.integration.ssh import check_system_python_version + pytestmark = [ pytest.mark.slow_test, pytest.mark.skip_on_windows(reason="salt-ssh not available on Windows"), + pytest.mark.skipif( + not check_system_python_version(), reason="Needs system python >= 3.9" + ), ] diff --git a/tests/pytests/integration/ssh/test_saltext.py b/tests/pytests/integration/ssh/test_saltext.py index aeef606ab3b..daaa0a90ffc 100644 --- a/tests/pytests/integration/ssh/test_saltext.py +++ b/tests/pytests/integration/ssh/test_saltext.py @@ -11,7 +11,7 @@ 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" + not check_system_python_version(), reason="Needs system python >= 3.9" ), ] diff --git a/tests/pytests/integration/ssh/test_slsutil.py b/tests/pytests/integration/ssh/test_slsutil.py index 10c9f985139..3bd1f7c5028 100644 --- a/tests/pytests/integration/ssh/test_slsutil.py +++ b/tests/pytests/integration/ssh/test_slsutil.py @@ -1,25 +1,13 @@ 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") - +from tests.pytests.integration.ssh import check_system_python_version pytestmark = [ pytest.mark.skip_unless_on_linux, pytest.mark.skipif( - not check_system_python_version(), reason="Needs system python >= 3.8" + not check_system_python_version(), reason="Needs system python >= 3.9" ), ] diff --git a/tests/unit/utils/test_thin.py b/tests/unit/utils/test_thin.py index cd617601e40..53b2148ee29 100644 --- a/tests/unit/utils/test_thin.py +++ b/tests/unit/utils/test_thin.py @@ -84,7 +84,6 @@ class SSHThinTestCase(TestCase): code_dir = pathlib.Path(RUNTIME_VARS.CODE_DIR).resolve() self.exp_ret = { "certifi": str(code_dir / "certifi"), - "distro": str(code_dir / "distro.py"), "idna": str(code_dir / "idna"), "jinja2": str(code_dir / "jinja2"), "msgpack": str(code_dir / "msgpack"), @@ -479,7 +478,6 @@ class SSHThinTestCase(TestCase): :return: """ base_tops = [ - "distro", "salt", "jinja2", "yaml", @@ -592,7 +590,6 @@ class SSHThinTestCase(TestCase): :return: """ base_tops = [ - "distro", "salt", "jinja2", "yaml", @@ -715,7 +712,6 @@ class SSHThinTestCase(TestCase): :return: """ base_tops = [ - "distro", "salt", "jinja2", "yaml", @@ -1184,7 +1180,6 @@ class SSHThinTestCase(TestCase): self._popen( None, side_effect=[ - (bts("distro.py"), bts("")), (bts("jinja2/__init__.py"), bts("")), (bts("yaml/__init__.py"), bts("")), (bts("tornado/__init__.py"), bts("")), @@ -1233,7 +1228,7 @@ class SSHThinTestCase(TestCase): self._popen( None, side_effect=[ - (bts("distro.py"), bts("")), + # (bts("distro.py"), bts("")), # (bts("jinja2/__init__.py"), bts("")), # (bts("yaml/__init__.py"), bts("")), (bts("tornado/__init__.py"), bts("")),