Move _pkg.txt into salt directory

This commit is contained in:
Megan Wilhite 2023-07-20 13:15:28 -06:00 committed by Pedro Algarvio
parent 86a8ddc6a5
commit a6ff8d0c23
6 changed files with 9 additions and 5 deletions

View file

@ -46,5 +46,5 @@ def test_grains_package_onedir(salt_cli, salt_minion):
Test that the package grain returns onedir
"""
ret = salt_cli.run("grains.get", "package", minion_tgt=salt_minion.id)
assert "onedir" == ret.data
assert ret.data == "onedir"
assert ret.data, ret

View file

@ -18,7 +18,7 @@ def pkg_type():
"""
Utility to find out how Salt was installed.
"""
pkg_file = pathlib.Path(__file__).parent.parent.parent / "_pkg.txt"
pkg_file = pathlib.Path(__file__).parent.parent / "_pkg.txt"
if pkg_file.is_file():
with salt.utils.files.fopen(pkg_file) as _fp:
content = _fp.read()

View file

@ -4,7 +4,7 @@ import pytest
@pytest.fixture(scope="package", autouse=True)
def onedir_env():
def _onedir_env():
"""
Functional tests cannot currently test the
onedir artifact. This will need to be removed
@ -18,6 +18,8 @@ def onedir_env():
yield
finally:
os.environ["ONEDIR_TESTRUN"] = "1"
else:
yield
@pytest.fixture(scope="module")

View file

@ -6,7 +6,7 @@ import salt.config
@pytest.fixture(scope="package", autouse=True)
def onedir_env():
def _onedir_env():
"""
Unit tests cannot currently test the
onedir artifact. This will need to be removed
@ -18,6 +18,8 @@ def onedir_env():
yield
finally:
os.environ["ONEDIR_TESTRUN"] = "1"
else:
yield
@pytest.fixture

View file

@ -749,7 +749,7 @@ def salt_onedir(
shutil.copyfile(src, dst)
# Add package type file for package grain
with open(pathlib.Path(site_packages) / "_pkg.txt", "w") as fp:
with open(pathlib.Path(site_packages) / "salt" / "_pkg.txt", "w") as fp:
fp.write("onedir")