[tests] Keep PlatformIO libdeps per xdist worker to stop a compile race (#18524)

This commit is contained in:
J. Nick Koston
2026-08-20 11:51:57 +12:00
committed by Jesse Hills
parent e75a7a61fa
commit d9359a70c1
+5 -1
View File
@@ -60,7 +60,11 @@ def _get_platformio_env(cache_dir: Path) -> dict[str, str]:
env = os.environ.copy() env = os.environ.copy()
env["PLATFORMIO_CORE_DIR"] = str(cache_dir) env["PLATFORMIO_CORE_DIR"] = str(cache_dir)
env["PLATFORMIO_CACHE_DIR"] = str(cache_dir / ".cache") env["PLATFORMIO_CACHE_DIR"] = str(cache_dir / ".cache")
env["PLATFORMIO_LIBDEPS_DIR"] = str(cache_dir / "libdeps") # libdeps is keyed only by env name (the device name), and fixtures share
# names; two xdist workers first-compiling the same name race pio pkg
# install in the same directory. Keep libdeps per worker.
worker = os.environ.get("PYTEST_XDIST_WORKER", "master")
env["PLATFORMIO_LIBDEPS_DIR"] = str(cache_dir / "libdeps" / worker)
# Prevent cache cleaning during integration tests # Prevent cache cleaning during integration tests
env["ESPHOME_SKIP_CLEAN_BUILD"] = "1" env["ESPHOME_SKIP_CLEAN_BUILD"] = "1"
# Compile with THIS tree's esphome sources, not wherever the venv's editable # Compile with THIS tree's esphome sources, not wherever the venv's editable