fix test_version packages tests

This commit is contained in:
MKLeb 2023-01-18 20:14:05 -05:00 committed by Pedro Algarvio
parent a446019221
commit 1c97f28897
3 changed files with 15 additions and 6 deletions

View file

@ -1778,7 +1778,5 @@ def test_pkgs(session, coverage):
install_command = ["--progress-bar=off", "-r", requirements_file]
session.install(*install_command, silent=PIP_INSTALL_SILENT)
cmd_args = [
"pkg/tests/",
] + session.posargs
cmd_args = ["pkg/tests/"] + session.posargs
_pytest(session, coverage, cmd_args)

View file

@ -29,7 +29,7 @@ def version():
_version = ""
for artifact in ARTIFACTS_DIR.glob("**/*.*"):
_version = re.search(
r"([0-9].*)(\-[0-9].fc|\-[0-9].el|\+ds|\-[0-9].am|\-[0-9]-[a-z]*-[a-z]*[0-9_]*.(tar.gz|zip|exe|pkg|rpm))",
r"([0-9].*)(\-[0-9].fc|\-[0-9].el|\+ds|\-[0-9].am|(\-[0-9]-[a-z]*-[a-z]*[0-9_]*.|\-[0-9]*.*)(tar.gz|zip|exe|pkg|rpm))",
artifact.name,
)
if _version:

View file

@ -1,3 +1,5 @@
import pathlib
import subprocess
import sys
import pytest
@ -21,9 +23,18 @@ def test_salt_versions_report_master(install_salt):
)
ret.stdout.matcher.fnmatch_lines(["*Salt Version:*"])
if sys.platform == "win32":
ret.stdout.matcher.fnmatch_lines(["*Python: 3.8.16*"])
python_executable = pathlib.Path(
r"C:\Program Files\Salt Project\Salt\Scripts\python.exe"
)
else:
ret.stdout.matcher.fnmatch_lines(["*Python: 3.9.16*"])
python_executable = pathlib.Path("/opt/saltstack/salt/bin/python3")
py_version = subprocess.run(
[str(python_executable), "--version"],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
).stdout
py_version = py_version.decode().strip().replace(" ", ": ")
ret.stdout.matcher.fnmatch_lines([f"*{py_version}*"])
def test_salt_versions_report_minion(salt_cli, salt_minion):