Use python imports to identify fixtures (part 6/6)#5706
Merged
cognifloyd merged 3 commits intomasterfrom Aug 18, 2022
Merged
Conversation
07f6c46 to
56e7651
Compare
rush-skills
approved these changes
Aug 12, 2022
| from winrm_runner.winrm_base import WinRmBaseRunner | ||
|
|
||
| FIXTURES_PATH = os.path.join(os.path.dirname(__file__), "fixtures") | ||
| from .fixtures import FIXTURES_PATH |
Member
Author
There was a problem hiding this comment.
Alternatively we might be able to use this:
Suggested change
| from .fixtures import FIXTURES_PATH | |
| from tests.unit.fixtures import FIXTURES_PATH |
Relative import was simpler. But I'm fine either way.
1fb7909 to
bc952a5
Compare
16e7601 to
c6cd658
Compare
c6cd658 to
d45f381
Compare
arm4b
approved these changes
Aug 18, 2022
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
I'm working towards introducing
pants. Eventually 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.pyfile in each fixture that uses the fixturesloader utils (where helpful) to identify itself withPATHandNAMEvars.PATHand/orNAMEvars from that fixture.This PR focuses on the last couple fixtures.
Statistics
Changes Summary (mostly in
st2reactorwith a little in thewinrm_runner):fixture.py(each has 13 lines of copyright/license header):16*5=+80 lines__init__.pywhen that made more sense for a directory of fixtures-11 +17lines changed in test files to use the new fixture vars.We may find need to address additional fixtures in the future, but this is the end of this series of PRs.