Skip to content

Commit

Permalink
ci,test: Pass the build root path explicitly when running tests (#1318)
Browse files Browse the repository at this point in the history
  • Loading branch information
achimnol authored Jun 5, 2023
1 parent 28f3708 commit 3fe5a71
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pants.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 3 additions & 0 deletions src/ai/backend/plugin/entrypoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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():
Expand Down

0 comments on commit 3fe5a71

Please sign in to comment.