mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Wipe the extras directory between tests
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
This commit is contained in:
parent
d33a8b7b4a
commit
10e75b2a8f
1 changed files with 19 additions and 2 deletions
|
@ -1,7 +1,8 @@
|
|||
import json
|
||||
import os
|
||||
import pathlib
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
import pytest
|
||||
from pytestskipmarkers.utils import platform
|
||||
|
@ -18,7 +19,7 @@ def pypath():
|
|||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def wipe_pydeps(install_salt):
|
||||
def wipe_pydeps(install_salt, extras_pypath):
|
||||
try:
|
||||
yield
|
||||
finally:
|
||||
|
@ -32,6 +33,7 @@ def wipe_pydeps(install_salt):
|
|||
check=False,
|
||||
universal_newlines=True,
|
||||
)
|
||||
shutil.rmtree(extras_pypath, ignore_errors=True)
|
||||
|
||||
|
||||
def test_pip_install(salt_call_cli):
|
||||
|
@ -72,6 +74,21 @@ def test_pip_install_extras(install_salt, extras_pypath):
|
|||
)
|
||||
assert install_ret.returncode == 0
|
||||
|
||||
ret = subprocess.run(
|
||||
install_salt.binary_paths["pip"] + ["list", "--format=json"],
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
)
|
||||
assert ret.returncode == 0
|
||||
pkgs_installed = json.loads(ret.stdout.strip().decode())
|
||||
for pkg in pkgs_installed:
|
||||
if pkg["name"] == dep:
|
||||
break
|
||||
else:
|
||||
pytest.fail(
|
||||
f"The {dep!r} package was not found installed. Packages Installed: {pkgs_installed}"
|
||||
)
|
||||
|
||||
show_ret = subprocess.run(
|
||||
install_salt.binary_paths["pip"] + ["show", dep],
|
||||
stdout=subprocess.PIPE,
|
||||
|
|
Loading…
Add table
Reference in a new issue