From 3fe5a71c5be9d4e5a4f6bce4854c0b4b66e9fbfc Mon Sep 17 00:00:00 2001 From: Joongi Kim Date: Mon, 5 Jun 2023 18:53:33 +0900 Subject: [PATCH] ci,test: Pass the build root path explicitly when running tests (#1318) --- pants.toml | 3 +++ src/ai/backend/plugin/entrypoint.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/pants.toml b/pants.toml index d5b86918ff..f2d88931fe 100644 --- a/pants.toml +++ b/pants.toml @@ -37,6 +37,9 @@ root_patterns = [ "/tools/pants-plugins", ] +[test] +extra_env_vars = ["BACKEND_BUILD_ROOT=%(buildroot)s"] + [python] enable_resolves = true # When changing this main Python version: diff --git a/src/ai/backend/plugin/entrypoint.py b/src/ai/backend/plugin/entrypoint.py index 91a8b595cc..43a4fb3ffc 100644 --- a/src/ai/backend/plugin/entrypoint.py +++ b/src/ai/backend/plugin/entrypoint.py @@ -3,6 +3,7 @@ import configparser import itertools import logging +import os from importlib.metadata import EntryPoint, entry_points from pathlib import Path from typing import Iterable, Iterator, Optional @@ -145,6 +146,8 @@ def scan_entrypoint_from_plugin_checkouts(group_name: str) -> Iterator[EntryPoin def find_build_root(path: Optional[Path] = None) -> Path: + if env_build_root := os.environ.get("BACKEND_BUILD_ROOT", None): + return Path(env_build_root) cwd = Path.cwd() if path is None else path while True: if (cwd / "BUILD_ROOT").exists():