diff --git a/tests/pytests/functional/cache/test_mysql.py b/tests/pytests/functional/cache/test_mysql.py index 93c6c7c6f6..c1bd46bbba 100644 --- a/tests/pytests/functional/cache/test_mysql.py +++ b/tests/pytests/functional/cache/test_mysql.py @@ -11,6 +11,8 @@ docker = pytest.importorskip("docker") +pytest.importorskip("MySQLdb") + log = logging.getLogger(__name__) INSIDE_CONTAINER = os.getenv("HOSTNAME", "") == "salt-test-container" diff --git a/tests/pytests/functional/modules/test_pip.py b/tests/pytests/functional/modules/test_pip.py index 9b87735b68..e04baa7c43 100644 --- a/tests/pytests/functional/modules/test_pip.py +++ b/tests/pytests/functional/modules/test_pip.py @@ -22,6 +22,7 @@ ) @pytest.mark.requires_network @pytest.mark.slow_test +@pytest.mark.skip_if_binaries_missing("virtualenv", reason="Needs virtualenv binary") def test_list_available_packages(modules, pip_version, tmp_path): with VirtualEnv(venv_dir=tmp_path, pip_requirement=pip_version) as virtualenv: virtualenv.install("-U", pip_version) diff --git a/tests/pytests/functional/modules/test_system.py b/tests/pytests/functional/modules/test_system.py index 3b669c46af..2cd03a3a3e 100644 --- a/tests/pytests/functional/modules/test_system.py +++ b/tests/pytests/functional/modules/test_system.py @@ -61,7 +61,9 @@ def setup_teardown_vars(file, service, system): _machine_info = False try: - _systemd_timesyncd_available_ = service.available("systemd-timesyncd") + _systemd_timesyncd_available_ = service.available( + "systemd-timesyncd" + ) and not service.masked("systemd-timesyncd") if _systemd_timesyncd_available_: res = service.stop("systemd-timesyncd") assert res diff --git a/tests/pytests/functional/states/test_pip_state.py b/tests/pytests/functional/states/test_pip_state.py index 3fc6ac7a1d..1921751b5d 100644 --- a/tests/pytests/functional/states/test_pip_state.py +++ b/tests/pytests/functional/states/test_pip_state.py @@ -94,6 +94,7 @@ def test_pip_installed_removed(modules, states): @pytest.mark.slow_test +@pytest.mark.skip_if_binaries_missing("virtualenv", reason="Needs virtualenv binary") def test_pip_installed_removed_venv(tmp_path, create_virtualenv, states): venv_dir = tmp_path / "pip_installed_removed" create_virtualenv(str(venv_dir)) @@ -105,6 +106,7 @@ def test_pip_installed_removed_venv(tmp_path, create_virtualenv, states): @pytest.mark.slow_test +@pytest.mark.skip_if_binaries_missing("virtualenv", reason="Needs virtualenv binary") def test_pip_installed_errors(tmp_path, modules, state_tree): venv_dir = tmp_path / "pip-installed-errors" # Since we don't have the virtualenv created, pip.installed will @@ -141,6 +143,7 @@ def test_pip_installed_errors(tmp_path, modules, state_tree): assert state_return.result is True +@pytest.mark.skip_if_binaries_missing("virtualenv", reason="Needs virtualenv binary") def test_pip_installed_name_test_mode(tmp_path, create_virtualenv, states): """ Test pip.installed state while test=true @@ -154,6 +157,7 @@ def test_pip_installed_name_test_mode(tmp_path, create_virtualenv, states): assert name in ret.comment +@pytest.mark.skip_if_binaries_missing("virtualenv", reason="Needs virtualenv binary") def test_pip_installed_pkgs_test_mode(tmp_path, create_virtualenv, states): """ Test pip.installed state while test=true @@ -168,6 +172,7 @@ def test_pip_installed_pkgs_test_mode(tmp_path, create_virtualenv, states): @pytest.mark.slow_test +@pytest.mark.skip_if_binaries_missing("virtualenv", reason="Needs virtualenv binary") def test_issue_2028_pip_installed_state( tmp_path, modules, state_tree, get_python_executable ): @@ -226,6 +231,7 @@ def test_issue_2028_pip_installed_state( @pytest.mark.slow_test +@pytest.mark.skip_if_binaries_missing("virtualenv", reason="Needs virtualenv binary") def test_issue_2087_missing_pip(tmp_path, create_virtualenv, modules): venv_dir = tmp_path / "issue-2087-missing-pip" @@ -271,6 +277,7 @@ def test_issue_2087_missing_pip(tmp_path, create_virtualenv, modules): @pytest.mark.destructive_test @pytest.mark.slow_test @pytest.mark.skip_if_not_root +@pytest.mark.skip_if_binaries_missing("virtualenv", reason="Needs virtualenv binary") def test_issue_6912_wrong_owner(tmp_path, create_virtualenv, modules, states): # Setup virtual environment directory to be used throughout the test venv_dir = tmp_path / "6912-wrong-owner" @@ -338,6 +345,7 @@ def test_issue_6912_wrong_owner(tmp_path, create_virtualenv, modules, states): @pytest.mark.skip_on_darwin(reason="Test is flaky on macosx") @pytest.mark.slow_test @pytest.mark.skip_if_not_root +@pytest.mark.skip_if_binaries_missing("virtualenv", reason="Needs virtualenv binary") def test_issue_6912_wrong_owner_requirements_file( tmp_path, create_virtualenv, state_tree, modules, states ): @@ -409,6 +417,7 @@ def test_issue_6912_wrong_owner_requirements_file( @pytest.mark.destructive_test @pytest.mark.slow_test +@pytest.mark.skip_if_binaries_missing("virtualenv", reason="Needs virtualenv binary") def test_issue_6833_pip_upgrade_pip(tmp_path, create_virtualenv, modules, states): # Create the testing virtualenv if sys.platform == "win32": @@ -465,6 +474,7 @@ def test_issue_6833_pip_upgrade_pip(tmp_path, create_virtualenv, modules, states @pytest.mark.slow_test +@pytest.mark.skip_if_binaries_missing("virtualenv", reason="Needs virtualenv binary") def test_pip_installed_specific_env( tmp_path, state_tree_prod, states, create_virtualenv ): @@ -514,6 +524,7 @@ def test_pip_installed_specific_env( @pytest.mark.slow_test +@pytest.mark.skip_if_binaries_missing("virtualenv", reason="Needs virtualenv binary") def test_22359_pip_installed_unless_does_not_trigger_warnings( create_virtualenv, tmp_path, states ): diff --git a/tests/pytests/functional/states/test_x509_v2.py b/tests/pytests/functional/states/test_x509_v2.py index e74bdd73f3..5e61cfeaf9 100644 --- a/tests/pytests/functional/states/test_x509_v2.py +++ b/tests/pytests/functional/states/test_x509_v2.py @@ -15,7 +15,7 @@ pkcs12, ) - import salt.utils.x509 as x509util + x509util = pytest.importorskip("salt.utils.x509") HAS_LIBS = True except ImportError: diff --git a/tests/pytests/integration/cli/test_syndic_eauth.py b/tests/pytests/integration/cli/test_syndic_eauth.py index 218022b9e3..f893161936 100644 --- a/tests/pytests/integration/cli/test_syndic_eauth.py +++ b/tests/pytests/integration/cli/test_syndic_eauth.py @@ -6,6 +6,8 @@ import pytest +from salt.utils.versions import Version + docker = pytest.importorskip("docker") INSIDE_CONTAINER = os.getenv("HOSTNAME", "") == "salt-test-container" @@ -13,6 +15,10 @@ pytestmark = [ pytest.mark.core_test, pytest.mark.skipif(INSIDE_CONTAINER, reason="Cannot run in a container"), + pytest.mark.skipif( + Version(docker.__version__) < Version("4.0.0"), + reason="Test does not work in this version of docker-py", + ), ]