mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Fix the libvirt tests
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
This commit is contained in:
parent
8e5c1da7a3
commit
72aa076c59
1 changed files with 33 additions and 1 deletions
|
@ -2,6 +2,7 @@
|
|||
Validate the virt module
|
||||
"""
|
||||
import logging
|
||||
import sys
|
||||
from numbers import Number
|
||||
from xml.etree import ElementTree
|
||||
|
||||
|
@ -16,11 +17,34 @@ log = logging.getLogger(__name__)
|
|||
|
||||
pytestmark = [
|
||||
pytest.mark.slow_test,
|
||||
pytest.mark.skip_unless_on_linux,
|
||||
pytest.mark.skip_if_binaries_missing("docker"),
|
||||
]
|
||||
|
||||
|
||||
def _install_salt_dependencies(container):
|
||||
ret = container.run("bash", "-c", "echo $SALT_PY_VERSION")
|
||||
assert ret.returncode == 0
|
||||
if not ret.stdout:
|
||||
log.warning(
|
||||
"The 'SALT_PY_VERSION' environment variable is not set on the container"
|
||||
)
|
||||
salt_py_version = 3
|
||||
ret = container.run(
|
||||
"python3",
|
||||
"-c",
|
||||
"import sys; sys.stderr.write('{}.{}'.format(*sys.version_info))",
|
||||
)
|
||||
assert ret.returncode == 0
|
||||
if not ret.stdout:
|
||||
requirements_py_version = "py{}.{}".format(*sys.version_info)
|
||||
else:
|
||||
requirements_py_version = ret.stdout.strip()
|
||||
else:
|
||||
salt_py_version = requirements_py_version = ret.stdout.strip()
|
||||
|
||||
container.python_executable = f"python{salt_py_version}"
|
||||
|
||||
dependencies = []
|
||||
for package, version in salt.version.dependency_information():
|
||||
if package not in ("packaging", "looseversion"):
|
||||
|
@ -29,8 +53,16 @@ def _install_salt_dependencies(container):
|
|||
continue
|
||||
dependencies.append(f"{package}=={version}")
|
||||
if dependencies:
|
||||
ret = container.run("python3", "-m", "pip", "install", *dependencies)
|
||||
ret = container.run(
|
||||
container.python_executable,
|
||||
"-m",
|
||||
"pip",
|
||||
"install",
|
||||
f"--constraint=/salt/requirements/static/ci/py{requirements_py_version}/linux.txt",
|
||||
*dependencies,
|
||||
)
|
||||
log.debug("Install missing dependecies ret: %s", ret)
|
||||
assert ret.returncode == 0
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
|
|
Loading…
Add table
Reference in a new issue