mirror of
https://github.com/esphome/esphome.git
synced 2026-09-11 23:37:34 +00:00
Make the setup tests pass on Windows
The tests assumed a POSIX host, but pytest also runs on windows-latest. Both path flavours are now built with PurePosixPath and PureWindowsPath, which work on either host, the bin/Scripts layout is asserted against the host, and the executable bit is only checked where it exists. Also drops the trailing separator from PATH when PATH is unset, since an empty entry makes Unix search the working directory for executables.
This commit is contained in:
+6
-1
@@ -88,7 +88,12 @@ def venv_environment(venv: Path) -> dict[str, str]:
|
||||
env = dict(os.environ)
|
||||
env["VIRTUAL_ENV"] = str(venv)
|
||||
env.pop("PYTHONHOME", None)
|
||||
env["PATH"] = os.pathsep.join([str(bin_dir(venv)), env.get("PATH", "")])
|
||||
path = str(bin_dir(venv))
|
||||
# An empty entry would be appended if PATH is unset, and on Unix that means
|
||||
# the working directory is searched for executables.
|
||||
if existing := env.get("PATH"):
|
||||
path = os.pathsep.join([path, existing])
|
||||
env["PATH"] = path
|
||||
return env
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user