lablup / lablup/backend.ai

Remove explicit dependencies from test BUILD files to optimize test execution scope

Open
#7,809 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
670
Forks
183
Avg merge
17h 7m
Merged PRs (30d)
358

Description

## Problem

Test BUILD files under `tests/` have explicit dependencies like:

```
python_tests(
name="tests",
dependencies=[
"src/ai/backend/manager:src",
],
)
```

This causes **all tests** with this dependency to run whenever **any file** in `manager:src` (1636 files) changes, even if the test doesn't actually import that file.

## Impact

When using `--changed-dependents=transitive` for incremental testing:

- A change to a single manager file triggers ~85 test targets
- This defeats the purpose of incremental testing and wastes CI resources

## Solution

Remove explicit `dependencies` from test BUILD files. Pants automatically infers dependencies from Python import statements, so tests will only run when their **actually imported** files change.

## Scope

Files to modify:

- `tests/unit/manager/**/BUILD`
- `tests/unit/common/**/BUILD`
- `tests/unit/agent/**/BUILD`
- `tests/component/**/BUILD`
- `tests/unit/testutils/BUILD`

## Verification

After removal, verify:

1. `pants dependents src/ai/backend/manager:src` returns fewer test targets
1. Tests still pass: `pants test tests/unit/manager::`

JIRA Issue: BA-3779

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.