Optional cached imports - #72
Open
kristoffer-gustafsson wants to merge 5 commits into
Open
kristoffer-gustafsson wants to merge 5 commits into
kristoffer-gustafsson wants to merge 5 commits into
Conversation
This test checks that some warning is logged when multiple entry points are found for one module. However, this part of the code is never reached if on the second call with reuse_cached_imports = True instead of False. That is because the entrypoints are cached in the previous call, which skips _load_from_entrypoints where the warning is raised. Therefore ymmsl_cache is cleared before and after each test to ensure a clean slate. The failed test:: FAILED ymmsl/v0_2/tests/test_resolver.py::test_resolve_entrypoints_duplicate_name[True] - assert 0 == 1 + where 0 = len([])
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.
The ymmsl_cache assumes that the YMMSL_PATH and sys.path does not change between resolve calls, but in fact it can.
If it does, the cached module imports can become stale.
Therefore I have added this contract explicitly in the doc-string of the resolve method, along with an option to clear the cache before resolving.