Fix incorrect renaming of versioned packages #11
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.
Documentation
DELTA-2596: Mock treats foo/v2 and bar/v2 as conflicting imports (aliasing one to v3)Description
This fixes a bug introduced in #10, in which
mockconsiders different packages with the same version number to have the same package name, causing it to alias one of them to an incremented version number in the mock file. For example, the following imports......could be aliased to...
This PR addresses this by using package import info to look up each import's real package name, rather than assuming that the base of the import path is the package name.
Testing Considerations
This is a little difficult to write an integration test for in the
examplesdirectory because I would need to import some versioned modules. I didn't want to introduce otherwise irrelevant dependencies tomockjust to test this bug fix.So instead I've just confirmed locally that this fixes the issues reported here and here.
Versioning
Patch.