-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
10230 work around bpo-44070 by making filenames absolute before calling spec_from_file_location #1628
Conversation
|
https://www.irccloud.com/pastebin/Yx1hHCUh/3.8.10.pdb |
|
|
||
| self.assertEqual(goodpackage, package1) | ||
| self.assertIs(package1, sys.modules["goodpackage"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
part of "properly import and return that package." is adding the package to sys.modules
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but isn't import goodpackage doing the same thing?
just asking :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import goodpackage will set the "goodpackage" in sys.modules key if we forgot to set it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All good. Thanks for the quick fix.
Only a minor comment regarding the release notes.
| @@ -0,0 +1 @@ | |||
| trial.runner.filenameToModule now sets the correct module.__name__ and sys.modules key | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor comment...
I am not 100% I understand this release note.
| trial.runner.filenameToModule now sets the correct module.__name__ and sys.modules key | |
| trial.runner.filenameToModule now sets an absolute path to the module when updating module.__name__ and sys.modules key |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR fixes the whole module.__spec__. before the algorithm only got the module.__file__ correct on 3.7- and 3.10+
The module.__name__ was set incorrectly as the stem of the path passed to filenameToModule
10230 work around bpo-44070 by making filenames absolute before calling spec_from_file_location
Scope and purpose
fix test_moduleNotInPath and test_packageNotInPath as well as their TODOs'
Contributor Checklist:
tox -e lintto format my patch to meet the Twisted Coding Standard#character).reviewto the keywords field in Trac, and putting a link to this PR in the comment; it shows up in https://twisted.reviews/ now.The first line is automatically generated by GitHub based on PR ID and branch name.
The other lines generated by GitHub should be replaced.