Conversation
fe3ccb8 to
19d4023
Compare
Owner
Author
sbrodehl
requested changes
Oct 5, 2022
Collaborator
sbrodehl
left a comment
There was a problem hiding this comment.
Looks good so far, just two comments in the code on possibly duplicated code and regarding the renaming of modules in the mf.init-call.
19d4023 to
7fac07a
Compare
7fac07a to
327f13b
Compare
Owner
Author
|
Rebased onto master. |
327f13b to
86d303e
Compare
sbrodehl
approved these changes
Oct 6, 2022
github-actions Bot
pushed a commit
that referenced
this pull request
Oct 6, 2022
Bugfix: unexpected global package import
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.
Bugfix: Unreliable imports.
This MR finalizes #112 by fixing an unexpected global package-import instead of a local minifflask module.
Description
From #112 on, miniflask tries to use pythons
importstatement if possible to load modules.The solution was to import the module name using the
importname, i.e. without the module-base-directory in its identifier. Interestingly, this indeed loaded the correct modules in most cases.However, in case a system-module with that name exists, miniflask would load that instead of the local module.
Setup:
setup.pytest.Problem:
Due to a module under
./tests/event/beforeafter/modulesnamedsetup, the setup above will result in an error.Things done in this MR
The solution is quite simple: the module-
idactually contains the base-directory name (in case the module directory has not been named otherwise in themf.init-call - thus the string is correct in exactly those cases in which we want the internalimportto be used.There is one special case, that needed to be resolved to make this work consistently:
The miniflask-internal modules
settings,events,modules, etc. have been placed inminiflask/module/*, but have been referenced usingminiflask.*instead ofminiflask.module.*. To make things consistent, this MR moves all those modules directly into the miniflask base directory.Check all before creating this PR: