Skip to content

Conversation

@cognifloyd
Copy link
Member

@cognifloyd cognifloyd commented Sep 26, 2024

This PR has commits extracted from #6202 where I'm working on getting all of our unit tests to run under pants+pytest.

This PR adds dependency-related BUILD metadata required to run various tests. In general, this includes:

  • uses=[...]: Makes our pants-plugins/uses_services plugin check for running services before running the tests.
  • stevedore_namespaces=[...]: Includes all plugins of each type (each stevedore namespace) listed. For example, stevedore_namespaces=["st2common.runners.runner"] would make all runners available when running a set of tests.
  • entry_point_dependencies=[...]: A more fine-grained version of steveore_namespaces. Instead of including every plugin that provide a given type, this includes selected entry points. This is especially helpful for runner tests, so that noop_runner tests only require the noop runner, instead of all of the runners. This feature is part of pants 2.23. It is one of the reasons we updated to 2.23 alpha in Pants upgrade from 2.22.0 to 2.23.0a0 #6229 instead of waiting for a stable release.
  • dependencies=[...]: some tests depend on various files that pants cannot infer based on pants dependencies. For example, when a test runs an action via the API, there is no import that tells pants which action the test needs.
  • resources(...): some tests needed files that were not covered by any of the BUILD targets, so I added the files as resources.

It can be beneficial to step through the commits. That will show you which tests needed the metadata.

@pull-request-size pull-request-size bot added the size/L PR that changes 100-499 lines. Requires some effort to review. label Sep 26, 2024
@cognifloyd cognifloyd requested a review from a team September 26, 2024 17:24
@cognifloyd cognifloyd merged commit 79f55ec into master Sep 26, 2024
@cognifloyd cognifloyd deleted the pants-dep-metadata branch September 26, 2024 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement infrastructure: ci/cd pantsbuild size/L PR that changes 100-499 lines. Requires some effort to review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants