Update salt_factories_default_root_dir GH runners

Updates salt_factories_default_root_dir to use $RUNNER_TEMP if running
in CI and using Windows. This is setup by the Github Runner and
should be on the same disk as the checked out repo.

Without doing that, the salt_factories_default_root_dir will be in the
user's temp dir which is on a different disk. This causes the fileserver
to throw an error as it tries to combine file_roots from the repo and
pytest-salt-factories.
This commit is contained in:
Barney Sowood 2025-01-17 17:14:29 +00:00 committed by Daniel Wozniak
parent 9a327c5919
commit b0a06655e4

View file

@ -16,6 +16,7 @@ import _pytest.logging
import _pytest.skipping
import more_itertools
import pytest
import pytestskipmarkers
import salt
import salt._logging
@ -426,7 +427,8 @@ def pytest_itemcollected(item):
pytest.fail(
"The test {!r} appears to be written for pytest but it's not under"
" {!r}. Please move it there.".format(
item.nodeid, str(PYTESTS_DIR.relative_to(CODE_DIR)), pytrace=False
item.nodeid,
str(PYTESTS_DIR.relative_to(CODE_DIR)),
)
)
@ -801,6 +803,12 @@ def salt_factories_default_root_dir(salt_factories_default_root_dir):
dictionary, then that's the value used, and not the one returned by
this fixture.
"""
if os.environ.get("CI") and pytestskipmarkers.utils.platform.is_windows():
tempdir = pathlib.Path(
os.environ.get("RUNNER_TEMP", r"C:\Windows\Temp")
).resolve()
return tempdir / "stsuite"
return salt_factories_default_root_dir / "stsuite"