in container_images/pytest/main.py [0:0]
def setup_execution_root(cfg: TestConfig) -> Path:
"""Create execution directory and copy project's code to it.
Tox creates in-directory files, and its execution fails when the
source tree is mounted read-only.
Args:
package_root: Absolute path to the Python package's root directory.
Returns:
Absolute path to execution root.
"""
assert cfg.package_root.exists(), \
f"Expected {cfg.package_root} to exist and to be an absolute path."
exec_root = Path(tempfile.mkdtemp())
shutil.copytree(cfg.package_root, exec_root, dirs_exist_ok=True)
if cfg.local_deps:
dep_dir = exec_root / "deps"
dep_dir.mkdir()
for dep in cfg.local_deps:
shutil.copytree(cfg.repo_root.absolute() / dep, dep_dir / dep)
return Path(exec_root)