use a fixture for pylint_plugins test #5849
Merged
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 another part of introducing pants, as discussed in various TSC meetings.
Related PRs can be found in:
Overview of this PR
In #5848, I will add a GHA workflow to run some tests via pants, starting with tests in
pylint_plugins/
. But, the current tests in pylint_plugins import fromst2common
because that was a quick way to throw together the tests. This is a problem becausepylint_plugins/
andst2*
each use different resolves (and therefore separate lockfiles). That means that pants puts together the sandbox for running the pylint_plugins tests, it will not include the st2* modules.Note that running pylint ON our source code works just fine. In that case, pants knows we need pylint + any source plugins for pylint + the source code that pylint needs to inspect. For tests, however, everything is based on dependencies between targets. I could use a pants feature that puts our code in both the
st2
and thepylint_plugins
resolve, but that makes the lockfile and BUILD file management more complex.So, I copied a few bits from
st2common
into a test fixture for the pylint_plugins tests. The Makefile runs the pylint_plugins tests just before it runs pylint, so look in the "CI / Compile" jobs to see the test results (which pass). I've also tested with pants in #5848 to make sure this change works for both ways to test this.