Temporarily skip tests which were simply ignored before pytest

This commit is contained in:
Pedro Algarvio 2020-04-08 12:00:58 +01:00 committed by Daniel Wozniak
parent 2d4d1ff6d4
commit 63c1d2edf0
3 changed files with 23 additions and 5 deletions

View file

@ -42,6 +42,7 @@ from pytestsalt.utils import cli_scripts
from salt.ext import six
from salt.serializers import yaml
from salt.utils.immutabletypes import freeze
from tests.support.helpers import PRE_PYTEST_SKIP_OR_NOT, PRE_PYTEST_SKIP_REASON
from tests.support.runtests import RUNTIME_VARS
from tests.support.sminion import create_sminion
@ -480,6 +481,16 @@ def pytest_runtest_setup(item):
"""
Fixtures injection based on markers or test skips based on CLI arguments
"""
integration_utils_tests_path = os.path.join(
CODE_DIR, "tests", "integration", "utils"
)
if (
str(item.fspath).startswith(integration_utils_tests_path)
and PRE_PYTEST_SKIP_OR_NOT is True
):
item._skipped_by_mark = True
pytest.skip(PRE_PYTEST_SKIP_REASON)
destructive_tests_marker = item.get_closest_marker("destructive_test")
if destructive_tests_marker is not None or _has_unittest_attr(
item, "__destructive_test__"

View file

@ -3,17 +3,14 @@
Integration tests for functions located in the salt.cloud.__init__.py file.
"""
# Import Python Libs
from __future__ import absolute_import, print_function, unicode_literals
# Import Salt libs
import salt.cloud
# Import Salt Testing libs
from tests.integration.cloud.helpers.cloud_test_base import CloudTest
from tests.support.helpers import expensiveTest
from tests.support.helpers import PRE_PYTEST_SKIP, expensiveTest
@PRE_PYTEST_SKIP
class CloudClientTestCase(CloudTest):
"""
Integration tests for the CloudClient class. Uses DigitalOcean as a salt-cloud provider.

View file

@ -32,6 +32,7 @@ import threading
import time
import types
import pytest
import salt.ext.tornado.ioloop
import salt.ext.tornado.web
import salt.utils.files
@ -51,6 +52,15 @@ log = logging.getLogger(__name__)
HAS_SYMLINKS = None
PRE_PYTEST_SKIP_OR_NOT = "PRE_PYTEST_DONT_SKIP" not in os.environ
PRE_PYTEST_SKIP_REASON = (
"PRE PYTEST - This test was skipped before running under pytest"
)
PRE_PYTEST_SKIP = pytest.mark.skipif(
PRE_PYTEST_SKIP_OR_NOT, reason=PRE_PYTEST_SKIP_REASON
)
def no_symlinks():
"""
Check if git is installed and has symlinks enabled in the configuration.