mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Replace @skip_if_binaries_missing
with @pytest.mark.skip_if_binaries_missing
This commit is contained in:
parent
cd004c9e8a
commit
27f80cdc63
18 changed files with 45 additions and 58 deletions
|
@ -8,7 +8,7 @@ import salt.utils.path
|
|||
import salt.utils.platform
|
||||
import salt.utils.user
|
||||
from tests.support.case import ModuleCase
|
||||
from tests.support.helpers import dedent, skip_if_binaries_missing
|
||||
from tests.support.helpers import dedent
|
||||
from tests.support.runtests import RUNTIME_VARS
|
||||
from tests.support.unit import skipIf
|
||||
|
||||
|
@ -240,7 +240,7 @@ class CMDModuleTest(ModuleCase):
|
|||
ret = self.run_function("cmd.tty", [tty, "apply salt liberally"])
|
||||
self.assertTrue("Success" in ret)
|
||||
|
||||
@skip_if_binaries_missing(["which"])
|
||||
@pytest.mark.skip_if_binaries_missing("which")
|
||||
def test_which(self):
|
||||
"""
|
||||
cmd.which
|
||||
|
@ -251,7 +251,7 @@ class CMDModuleTest(ModuleCase):
|
|||
self.assertIsInstance(cmd_run, str)
|
||||
self.assertEqual(cmd_which.rstrip(), cmd_run.rstrip())
|
||||
|
||||
@skip_if_binaries_missing(["which"])
|
||||
@pytest.mark.skip_if_binaries_missing("which")
|
||||
def test_which_bin(self):
|
||||
"""
|
||||
cmd.which_bin
|
||||
|
|
|
@ -22,7 +22,7 @@ import salt.utils.files
|
|||
import salt.utils.platform
|
||||
from salt.utils.versions import LooseVersion
|
||||
from tests.support.case import ModuleCase
|
||||
from tests.support.helpers import change_cwd, skip_if_binaries_missing
|
||||
from tests.support.helpers import change_cwd
|
||||
from tests.support.runtests import RUNTIME_VARS
|
||||
from tests.support.unit import skipIf
|
||||
|
||||
|
@ -59,8 +59,8 @@ def _worktrees_supported():
|
|||
return False
|
||||
|
||||
|
||||
@skip_if_binaries_missing("git")
|
||||
@pytest.mark.windows_whitelisted
|
||||
@pytest.mark.skip_if_binaries_missing("git")
|
||||
class GitModuleTest(ModuleCase):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
|
|
|
@ -5,17 +5,17 @@ import pytest
|
|||
import salt.utils.files
|
||||
import salt.utils.user
|
||||
from tests.support.case import ModuleCase
|
||||
from tests.support.helpers import skip_if_binaries_missing
|
||||
from tests.support.mixins import AdaptedConfigurationTestCaseMixin
|
||||
from tests.support.runtests import RUNTIME_VARS
|
||||
from tests.support.unit import skipIf
|
||||
|
||||
|
||||
# Acl package should be installed to test linux_acl module
|
||||
@skip_if_binaries_missing(["getfacl"])
|
||||
# Doesn't work. Why?
|
||||
# @requires_salt_modules('acl')
|
||||
# @requires_salt_modules('linux_acl')
|
||||
# Acl package should be installed to test linux_acl module
|
||||
|
||||
|
||||
@pytest.mark.skip_if_binaries_missing("getfacl")
|
||||
@pytest.mark.windows_whitelisted
|
||||
class LinuxAclModuleTest(ModuleCase, AdaptedConfigurationTestCaseMixin):
|
||||
"""
|
||||
|
|
|
@ -4,7 +4,6 @@ Test the lxc module
|
|||
|
||||
import pytest
|
||||
from tests.support.case import ModuleCase
|
||||
from tests.support.helpers import skip_if_binaries_missing
|
||||
from tests.support.unit import skipIf
|
||||
|
||||
|
||||
|
@ -13,11 +12,11 @@ from tests.support.unit import skipIf
|
|||
"Needs rewrite to be more distro agnostic. Also, the tearDown "
|
||||
"function destroys ALL containers on the box, which is BAD.",
|
||||
)
|
||||
@skip_if_binaries_missing(
|
||||
"lxc-start", message="LXC is not installed or minimal version not met"
|
||||
)
|
||||
@pytest.mark.windows_whitelisted
|
||||
@pytest.mark.skip_if_not_root
|
||||
@pytest.mark.skip_if_binaries_missing(
|
||||
"lxc-start", message="LXC is not installed or minimal version not met"
|
||||
)
|
||||
class LXCModuleTest(ModuleCase):
|
||||
"""
|
||||
Test the lxc module
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
import pytest
|
||||
from salt.exceptions import CommandExecutionError
|
||||
from tests.support.case import ModuleCase
|
||||
from tests.support.helpers import runs_on, skip_if_binaries_missing
|
||||
from tests.support.helpers import runs_on
|
||||
|
||||
# Brew doesn't support local package installation - So, let's
|
||||
# Grab some small packages available online for brew
|
||||
|
@ -14,9 +14,9 @@ DEL_PKG = "acme"
|
|||
|
||||
|
||||
@pytest.mark.skip_if_not_root
|
||||
@skip_if_binaries_missing("brew")
|
||||
@runs_on(kernel="Darwin")
|
||||
@pytest.mark.destructive_test
|
||||
@pytest.mark.skip_if_binaries_missing("brew")
|
||||
class BrewModuleTest(ModuleCase):
|
||||
"""
|
||||
Integration tests for the brew module
|
||||
|
|
|
@ -6,11 +6,7 @@ import os
|
|||
|
||||
import pytest
|
||||
from tests.support.case import ModuleCase
|
||||
from tests.support.helpers import (
|
||||
requires_system_grains,
|
||||
runs_on,
|
||||
skip_if_binaries_missing,
|
||||
)
|
||||
from tests.support.helpers import requires_system_grains, runs_on
|
||||
from tests.support.runtests import RUNTIME_VARS
|
||||
|
||||
TEST_PKG_URL = (
|
||||
|
@ -20,8 +16,8 @@ TEST_PKG_NAME = "org.macports.MacPorts"
|
|||
|
||||
|
||||
@runs_on(kernel="Darwin")
|
||||
@skip_if_binaries_missing("pkgutil")
|
||||
@pytest.mark.skip_if_not_root
|
||||
@pytest.mark.skip_if_binaries_missing("pkgutil")
|
||||
class MacPkgutilModuleTest(ModuleCase):
|
||||
"""
|
||||
Validate the mac_pkgutil module
|
||||
|
|
|
@ -4,12 +4,12 @@ integration tests for mac_ports
|
|||
|
||||
import pytest
|
||||
from tests.support.case import ModuleCase
|
||||
from tests.support.helpers import runs_on, skip_if_binaries_missing
|
||||
from tests.support.helpers import runs_on
|
||||
|
||||
|
||||
@pytest.mark.skip_if_not_root
|
||||
@runs_on(kernel="Darwin")
|
||||
@skip_if_binaries_missing("port")
|
||||
@pytest.mark.skip_if_binaries_missing("port")
|
||||
class MacPortsModuleTest(ModuleCase):
|
||||
"""
|
||||
Validate the mac_ports module
|
||||
|
|
|
@ -4,12 +4,12 @@ integration tests for mac_power
|
|||
|
||||
import pytest
|
||||
from tests.support.case import ModuleCase
|
||||
from tests.support.helpers import flaky, runs_on, skip_if_binaries_missing
|
||||
from tests.support.helpers import flaky, runs_on
|
||||
|
||||
|
||||
@flaky(attempts=10)
|
||||
@runs_on(kernel="Darwin")
|
||||
@skip_if_binaries_missing("systemsetup")
|
||||
@pytest.mark.skip_if_binaries_missing("systemsetup")
|
||||
@pytest.mark.skip_if_not_root
|
||||
class MacPowerModuleTest(ModuleCase):
|
||||
"""
|
||||
|
@ -153,7 +153,7 @@ class MacPowerModuleTest(ModuleCase):
|
|||
|
||||
@flaky(attempts=10)
|
||||
@runs_on(kernel="Darwin")
|
||||
@skip_if_binaries_missing("systemsetup")
|
||||
@pytest.mark.skip_if_binaries_missing("systemsetup")
|
||||
@pytest.mark.skip_if_not_root
|
||||
class MacPowerModuleTestSleepOnPowerButton(ModuleCase):
|
||||
"""
|
||||
|
@ -204,7 +204,7 @@ class MacPowerModuleTestSleepOnPowerButton(ModuleCase):
|
|||
|
||||
@flaky(attempts=10)
|
||||
@runs_on(kernel="Darwin")
|
||||
@skip_if_binaries_missing("systemsetup")
|
||||
@pytest.mark.skip_if_binaries_missing("systemsetup")
|
||||
@pytest.mark.skip_if_not_root
|
||||
class MacPowerModuleTestRestartPowerFailure(ModuleCase):
|
||||
"""
|
||||
|
@ -254,7 +254,7 @@ class MacPowerModuleTestRestartPowerFailure(ModuleCase):
|
|||
|
||||
@flaky(attempts=10)
|
||||
@runs_on(kernel="Darwin")
|
||||
@skip_if_binaries_missing("systemsetup")
|
||||
@pytest.mark.skip_if_binaries_missing("systemsetup")
|
||||
@pytest.mark.skip_if_not_root
|
||||
class MacPowerModuleTestWakeOnNet(ModuleCase):
|
||||
"""
|
||||
|
@ -300,7 +300,7 @@ class MacPowerModuleTestWakeOnNet(ModuleCase):
|
|||
|
||||
@flaky(attempts=10)
|
||||
@runs_on(kernel="Darwin")
|
||||
@skip_if_binaries_missing("systemsetup")
|
||||
@pytest.mark.skip_if_binaries_missing("systemsetup")
|
||||
@pytest.mark.skip_if_not_root
|
||||
class MacPowerModuleTestWakeOnModem(ModuleCase):
|
||||
"""
|
||||
|
|
|
@ -7,12 +7,12 @@ import plistlib
|
|||
import pytest
|
||||
import salt.utils.files
|
||||
from tests.support.case import ModuleCase
|
||||
from tests.support.helpers import runs_on, skip_if_binaries_missing
|
||||
from tests.support.helpers import runs_on
|
||||
|
||||
|
||||
@pytest.mark.skip_if_not_root
|
||||
@runs_on(kernel="Darwin")
|
||||
@skip_if_binaries_missing("launchctl", "plutil")
|
||||
@pytest.mark.skip_if_binaries_missing("launchctl", "plutil")
|
||||
class MacServiceModuleTest(ModuleCase):
|
||||
"""
|
||||
Validate the mac_service module
|
||||
|
|
|
@ -6,14 +6,14 @@ import datetime
|
|||
|
||||
import pytest
|
||||
from tests.support.case import ModuleCase
|
||||
from tests.support.helpers import random_string, runs_on, skip_if_binaries_missing
|
||||
from tests.support.helpers import random_string, runs_on
|
||||
|
||||
TEST_USER = random_string("RS-", lowercase=False)
|
||||
NO_USER = random_string("RS-", lowercase=False)
|
||||
|
||||
|
||||
@runs_on(kernel="Darwin")
|
||||
@skip_if_binaries_missing("dscl", "pwpolicy")
|
||||
@pytest.mark.skip_if_binaries_missing("dscl", "pwpolicy")
|
||||
@pytest.mark.skip_if_not_root
|
||||
class MacShadowModuleTest(ModuleCase):
|
||||
"""
|
||||
|
|
|
@ -4,12 +4,12 @@ integration tests for mac_softwareupdate
|
|||
|
||||
import pytest
|
||||
from tests.support.case import ModuleCase
|
||||
from tests.support.helpers import runs_on, skip_if_binaries_missing
|
||||
from tests.support.helpers import runs_on
|
||||
|
||||
|
||||
@pytest.mark.skip_if_not_root
|
||||
@runs_on(kernel="Darwin")
|
||||
@skip_if_binaries_missing("softwareupdate")
|
||||
@pytest.mark.skip_if_binaries_missing("softwareupdate")
|
||||
class MacSoftwareUpdateModuleTest(ModuleCase):
|
||||
"""
|
||||
Validate the mac_softwareupdate module
|
||||
|
|
|
@ -6,12 +6,7 @@ import logging
|
|||
|
||||
import pytest
|
||||
from tests.support.case import ModuleCase
|
||||
from tests.support.helpers import (
|
||||
flaky,
|
||||
random_string,
|
||||
runs_on,
|
||||
skip_if_binaries_missing,
|
||||
)
|
||||
from tests.support.helpers import flaky, random_string, runs_on
|
||||
from tests.support.unit import skipIf
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
@ -23,9 +18,9 @@ SET_SUBNET_NAME = random_string("RS-", lowercase=False)
|
|||
|
||||
@flaky(attempts=10)
|
||||
@runs_on(kernel="Darwin")
|
||||
@skip_if_binaries_missing("systemsetup")
|
||||
@pytest.mark.usefixtures("salt_sub_minion")
|
||||
@pytest.mark.skip_if_not_root
|
||||
@pytest.mark.skip_if_binaries_missing("systemsetup")
|
||||
class MacSystemModuleTest(ModuleCase):
|
||||
"""
|
||||
Validate the mac_system module
|
||||
|
|
|
@ -13,13 +13,13 @@ import datetime
|
|||
|
||||
import pytest
|
||||
from tests.support.case import ModuleCase
|
||||
from tests.support.helpers import flaky, runs_on, skip_if_binaries_missing
|
||||
from tests.support.helpers import flaky, runs_on
|
||||
from tests.support.unit import skipIf
|
||||
|
||||
|
||||
@flaky
|
||||
@runs_on(kernel="Darwin")
|
||||
@skip_if_binaries_missing("systemsetup")
|
||||
@pytest.mark.skip_if_binaries_missing("systemsetup")
|
||||
@pytest.mark.skip_if_not_root
|
||||
class MacTimezoneModuleTest(ModuleCase):
|
||||
"""
|
||||
|
|
|
@ -6,12 +6,12 @@ import os
|
|||
|
||||
import pytest
|
||||
from tests.support.case import ModuleCase
|
||||
from tests.support.helpers import runs_on, skip_if_binaries_missing
|
||||
from tests.support.helpers import runs_on
|
||||
from tests.support.runtests import RUNTIME_VARS
|
||||
|
||||
|
||||
@runs_on(kernel="Darwin")
|
||||
@skip_if_binaries_missing("xattr")
|
||||
@pytest.mark.skip_if_binaries_missing("xattr")
|
||||
class MacXattrModuleTest(ModuleCase):
|
||||
"""
|
||||
Validate the mac_xattr module
|
||||
|
|
|
@ -10,7 +10,6 @@ import salt.utils.files
|
|||
import salt.utils.platform
|
||||
from salt.ext.tornado.httpclient import HTTPClient
|
||||
from tests.support.case import ModuleCase
|
||||
from tests.support.helpers import skip_if_binaries_missing
|
||||
from tests.support.runtests import RUNTIME_VARS
|
||||
|
||||
GITHUB_FINGERPRINT = "9d:38:5b:83:a9:17:52:92:56:1a:5e:c4:d4:81:8e:0a:ca:51:a2:64:f1:74:20:11:2e:f8:8a:c3:a1:39:49:8f"
|
||||
|
@ -26,8 +25,8 @@ def check_status():
|
|||
return False
|
||||
|
||||
|
||||
@skip_if_binaries_missing(["ssh", "ssh-keygen"], check_all=True)
|
||||
@pytest.mark.windows_whitelisted
|
||||
@pytest.mark.skip_if_binaries_missing("ssh", "ssh-keygen", check_all=True)
|
||||
class SSHModuleTest(ModuleCase):
|
||||
"""
|
||||
Test the ssh module
|
||||
|
|
|
@ -7,7 +7,6 @@ import shutil
|
|||
|
||||
import pytest
|
||||
from tests.support.case import ModuleCase
|
||||
from tests.support.helpers import skip_if_binaries_missing
|
||||
from tests.support.mixins import SaltReturnAssertsMixin
|
||||
from tests.support.runtests import RUNTIME_VARS
|
||||
|
||||
|
@ -15,7 +14,7 @@ GITHUB_FINGERPRINT = "9d:38:5b:83:a9:17:52:92:56:1a:5e:c4:d4:81:8e:0a:ca:51:a2:6
|
|||
GITHUB_IP = "192.30.253.113"
|
||||
|
||||
|
||||
@skip_if_binaries_missing(["ssh", "ssh-keygen"], check_all=True)
|
||||
@pytest.mark.skip_if_binaries_missing("ssh", "ssh-keygen", check_all=True)
|
||||
class SSHKnownHostsStateTest(ModuleCase, SaltReturnAssertsMixin):
|
||||
"""
|
||||
Validate the ssh state
|
||||
|
|
|
@ -7,7 +7,6 @@ from xml.etree import ElementTree
|
|||
|
||||
import pytest
|
||||
from saltfactories.utils import cli_scripts
|
||||
from tests.support.helpers import skip_if_binaries_missing
|
||||
from tests.support.virt import SaltVirtMinionContainerFactory
|
||||
|
||||
docker = pytest.importorskip("docker")
|
||||
|
@ -157,8 +156,8 @@ def salt_cli(salt_master, virt_minion_0, virt_minion_1):
|
|||
return salt_master.get_salt_cli()
|
||||
|
||||
|
||||
@skip_if_binaries_missing("docker")
|
||||
@pytest.mark.slow_test
|
||||
@pytest.mark.skip_if_binaries_missing("docker")
|
||||
class TestVirtTest:
|
||||
"""
|
||||
Test virt routines
|
||||
|
@ -414,8 +413,8 @@ def prep_virt(salt_cli, virt_minion_0, virt_minion_1, virt_domain):
|
|||
salt_cli.run("virt.undefine", virt_domain, minion_tgt=virt_minion_1.id)
|
||||
|
||||
|
||||
@skip_if_binaries_missing("docker")
|
||||
@pytest.mark.slow_test
|
||||
@pytest.mark.skip_if_binaries_missing("docker")
|
||||
class TestVirtMigrateTest:
|
||||
def test_define_xml_path(self, salt_cli, virt_minion_0, virt_domain):
|
||||
"""
|
||||
|
|
|
@ -7,14 +7,14 @@ import hashlib
|
|||
import time
|
||||
from subprocess import PIPE, Popen
|
||||
|
||||
import pytest
|
||||
import salt.modules.k8s as k8s
|
||||
import salt.utils.files
|
||||
import salt.utils.json
|
||||
from tests.support.helpers import skip_if_binaries_missing
|
||||
from tests.support.unit import TestCase
|
||||
|
||||
|
||||
@skip_if_binaries_missing(["kubectl"])
|
||||
@pytest.mark.skip_if_binaries_missing("kubectl")
|
||||
class TestK8SNamespace(TestCase):
|
||||
|
||||
maxDiff = None
|
||||
|
@ -50,7 +50,7 @@ class TestK8SNamespace(TestCase):
|
|||
self.assertTrue(isinstance(kubectl_out, dict))
|
||||
|
||||
|
||||
@skip_if_binaries_missing(["kubectl"])
|
||||
@pytest.mark.skip_if_binaries_missing("kubectl")
|
||||
class TestK8SSecrets(TestCase):
|
||||
|
||||
maxDiff = None
|
||||
|
@ -201,7 +201,7 @@ class TestK8SSecrets(TestCase):
|
|||
)
|
||||
|
||||
|
||||
@skip_if_binaries_missing(["kubectl"])
|
||||
@pytest.mark.skip_if_binaries_missing("kubectl")
|
||||
class TestK8SResourceQuotas(TestCase):
|
||||
|
||||
maxDiff = None
|
||||
|
@ -403,7 +403,7 @@ spec:
|
|||
self.assertEqual("2Gi", limit)
|
||||
|
||||
|
||||
@skip_if_binaries_missing(["kubectl"])
|
||||
@pytest.mark.skip_if_binaries_missing("kubectl")
|
||||
class TestK8SLimitRange(TestCase):
|
||||
|
||||
maxDiff = None
|
||||
|
|
Loading…
Add table
Reference in a new issue