-
-
Notifications
You must be signed in to change notification settings - Fork 751
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pants: Use python imports to identify fixtures #6240
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
First, add metadata so pants can load the packs base path fixtures from st2common/resources for the content laoder tests. Second, add a fixture.py file in each base path, similar to the fixtures we have in st2tests, so that pants dependency inferrence can see where these fixtures are used. Third, the fixture file ended up creating a __pycache__ directory in the packs base paths which made tests fail due to an unexpected extra "pack" named "__pycache__". So, I excluded that as a valid pack name.
First, add metadata so pants can load the conf fixture from st2common/tests/resources for the logger test. Second, add a fixture.py file, similar to the fixtures we have in st2tests, so that pants dependency inferrence can see where these fixtures are used.
First, add metadata so pants can load the loadableplugin fixture from st2common/tests/resources for the plugin loader test. Second, add a fixture.py file, similar to the fixtures we have in st2tests, so that pants dependency inferrence can see where these fixtures are used.
e744b47
to
7c74079
Compare
nzlosh
approved these changes
Sep 14, 2024
amanda11
approved these changes
Sep 16, 2024
guzzijones
approved these changes
Sep 16, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
infrastructure: ci/cd
pantsbuild
size/L
PR that changes 100-499 lines. Requires some effort to review.
tests
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Background
This is part of introducing
pants
. I would like to use pants to run tests to take advantage of the fine-grained per-file caching of results that accounts for dependencies by python files (pants infers the deps by reading the python files).In order to use the fine-grained caching, Pants needs to know which tests rely on which fixtures. We could add extra metadata to tie the tests to the fixtures, but that would be an additional maintenance burden that will become out-of-date. We can also include all fixtures for all tests, but then we don't benefit from the fine-grained per-file caching. However, pants can already infer dependencies based on python imports, so that is what this PR (and several follow-up PRs) takes advantage of.
Overview
This PR does the following:
__init__.py
.fixture.py
file in each fixture that uses the fixturesloader utils (where helpful) to identify itself withPATH
andNAME
vars.PATH
and/orNAME
vars from that fixture.This PR focuses on the fixture usages I missed in: