Skip to content

fix: allow shared/re-used deps lists across py_test targets#1013

Open
racosta wants to merge 1 commit into
aspect-build:mainfrom
racosta:reuse-common-deps-list-in-tests
Open

fix: allow shared/re-used deps lists across py_test targets#1013
racosta wants to merge 1 commit into
aspect-build:mainfrom
racosta:reuse-common-deps-list-in-tests

Conversation

@racosta
Copy link
Copy Markdown

@racosta racosta commented May 13, 2026

If there is a common list of dependencies which are shared across multiple py_test targets and pytest_main is set to True on both of them there is a build issue because the deps list is mutated and //py/private:default_pytest_main is included twice/multiple times.


Changes are visible to end-users: no

Test plan

  • New test cases added
    • Added two tests to demonstrate the behavior. Both must be built together to demonstrate the build issue:

      1. //py/tests/py-test:test_pytest_main_shared_deps_a
      2. //py/tests/py-test:test_pytest_main_shared_deps_b

      bazel test //py/tests/py-test:test_pytest_main_shared_deps_a //py/tests/py-test:test_pytest_main_shared_deps_b

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented May 13, 2026

CLA assistant check
All committers have signed the CLA.

@aspect-workflows
Copy link
Copy Markdown

aspect-workflows Bot commented May 13, 2026

Bazel 8 (Test)

2 test targets passed

Targets
//py/tests/py-test:test_pytest_main_shared_deps_a [k8-fastbuild]                 659ms
//py/tests/py-test:test_pytest_main_shared_deps_b [k8-fastbuild]                 714ms

Total test execution time was 1s. 177 tests (98.9%) were fully cached saving 1m 4s.


Bazel 9 (Test)

2 test targets passed

Targets
//py/tests/py-test:test_pytest_main_shared_deps_a [k8-fastbuild]                 755ms
//py/tests/py-test:test_pytest_main_shared_deps_b [k8-fastbuild]                 706ms

Total test execution time was 1s. 176 tests (98.9%) were fully cached saving 1m 10s.


Bazel 8 (Test)

e2e

All tests were cache hits

103 tests (100.0%) were fully cached saving 1m 21s.


Bazel 9 (Test)

e2e

All tests were cache hits

103 tests (100.0%) were fully cached saving 55s.


Bazel 8 (Test)

examples/uv_pip_compile

All tests were cache hits

1 test (100.0%) was fully cached saving 444ms.


Buildifier      Gazelle

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants