mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Set tempdir for Windows in tests/conftest.py
This commit is contained in:
parent
065f9c6486
commit
c364ff55cb
1 changed files with 14 additions and 0 deletions
|
@ -117,6 +117,20 @@ log = logging.getLogger("salt.testsuite")
|
|||
|
||||
|
||||
# ----- PyTest Tempdir Plugin Hooks --------------------------------------------------------------------------------->
|
||||
def pytest_tempdir_temproot():
|
||||
# Taken from https://github.com/saltstack/salt/blob/v2019.2.0/tests/support/paths.py
|
||||
# Avoid ${TMPDIR} and gettempdir() on MacOS as they yield a base path too long
|
||||
# for unix sockets: ``error: AF_UNIX path too long``
|
||||
# Gentoo Portage prefers ebuild tests are rooted in ${TMPDIR}
|
||||
if saltfactories.utils.platform.is_windows():
|
||||
tempdir = "c:/temp"
|
||||
elif saltfactories.utils.platform.is_darwin():
|
||||
tempdir = "/tmp"
|
||||
else:
|
||||
tempdir = os.environ.get("TMPDIR") or tempfile.gettempdir()
|
||||
return os.path.abspath(os.path.realpath(tempdir))
|
||||
|
||||
|
||||
def pytest_tempdir_basename():
|
||||
"""
|
||||
Return the temporary directory basename for the salt test suite.
|
||||
|
|
Loading…
Add table
Reference in a new issue