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.
Stub out many adapter methods at parse time. Unfortunately this doesn't appear to reduce the integration test runtime, but I've verified it does prevent calls to the various
adapter
methods from running (with a real project) and added unit tests about it. It nicely solves the problem of needing to parse files before being able to populate the cache by stubbing out everything that might want the cache at parse-time.already_exists
returns False for consistency withget_relation
.I'm not sure this is the most perfect way of doing it, but using it does feel reasonably pleasant and it seems more sustainable than overriding it manually inside the parser or something. I stole the
available.parse = available_parse
idea from mock'spatch.object
.I think the biggest downside is that you have to decide whether or not to stub it out in parsing when you mark them available, not at actual implementation time, because the wrapper only delegates the top-level call, and subsequent accesses to
self
hit the wrapped adapter only. I think that's pretty much fine, but I did want to call it out.