mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Download package test are now skipped by default.
Passing `--download-pkgs` will enable them. Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
This commit is contained in:
parent
a6b89f1640
commit
0144652d3c
2 changed files with 24 additions and 3 deletions
|
@ -1718,6 +1718,7 @@ def test_pkgs_onedir(session):
|
|||
"--no-uninstall",
|
||||
],
|
||||
"download-pkgs": [
|
||||
"--download-pkgs",
|
||||
"pkg/tests/download/test_pkg_download.py",
|
||||
],
|
||||
}
|
||||
|
|
|
@ -1,15 +1,13 @@
|
|||
import logging
|
||||
import pathlib
|
||||
import re
|
||||
import shutil
|
||||
|
||||
import pytest
|
||||
from pytestskipmarkers.utils import platform
|
||||
from saltfactories.utils import cli_scripts, random_string
|
||||
from saltfactories.utils import random_string
|
||||
from saltfactories.utils.tempfiles import SaltPillarTree, SaltStateTree
|
||||
|
||||
from tests.support.helpers import (
|
||||
ARTIFACTS_DIR,
|
||||
CODE_DIR,
|
||||
TESTS_DIR,
|
||||
ApiRequest,
|
||||
|
@ -70,6 +68,28 @@ def pytest_addoption(parser):
|
|||
action="store",
|
||||
help="Test an upgrade from the version specified.",
|
||||
)
|
||||
test_selection_group.addoption(
|
||||
"--download-pkgs",
|
||||
default=False,
|
||||
action="store_true",
|
||||
help="Test package download tests",
|
||||
)
|
||||
|
||||
|
||||
@pytest.hookimpl(tryfirst=True)
|
||||
def pytest_runtest_setup(item):
|
||||
"""
|
||||
Fixtures injection based on markers or test skips based on CLI arguments
|
||||
"""
|
||||
if (
|
||||
str(item.fspath).startswith(str(pathlib.Path(__file__).parent / "download"))
|
||||
and item.config.getoption("--download-pkgs") is False
|
||||
):
|
||||
raise pytest.skip.Exception(
|
||||
"The package download tests are disabled. Pass '--download-pkgs' to pytest "
|
||||
"to enable them.",
|
||||
_use_item_location=True,
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
|
|
Loading…
Add table
Reference in a new issue