-
-
Notifications
You must be signed in to change notification settings - Fork 1
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
Fix an error when loading namespace packages #28
Conversation
@ale-rt thanks for creating this Pull Request and helping to improve Plone! TL;DR: Finish pushing changes, pass all other checks, then paste a comment:
To ensure that these changes do not break other parts of Plone, the Plone test suite matrix needs to pass, but it takes 30-60 min. Other CI checks are usually much faster and the Plone Jenkins resources are limited, so when done pushing changes and all other checks pass either start all Jenkins PR jobs yourself, or simply add the comment above in this PR to start all the jobs automatically. Happy hacking! |
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 needs an extra import importlib.metadata
. The current import importlib
is not enough.
On Python 3.9, entry_points
does not accept any arguments, so this needs some fixes, see the Compatibility note at the end of the entry points documentation. Maybe indeed use importlib_metadata
as an extra requirement on Python 3.9, if that helps, in a similar way to your follow-up PR #29, though I don't like the extra dependency.
Also on other Python versions, the integration tests fail, because not all expected zcml is loaded. For example:
Failure in test test_configure (example.zopeintegration.tests.TestIntegration.test_configure)
Traceback (most recent call last):
File "/usr/local/Cellar/[email protected]/3.12.8/Frameworks/Python.framework/Versions/3.12/lib/python3.12/unittest/case.py", line 58, in testPartExecutor
yield
File "/usr/local/Cellar/[email protected]/3.12.8/Frameworks/Python.framework/Versions/3.12/lib/python3.12/unittest/case.py", line 634, in run
self._callTestMethod(testMethod)
File "/usr/local/Cellar/[email protected]/3.12.8/Frameworks/Python.framework/Versions/3.12/lib/python3.12/unittest/case.py", line 589, in _callTestMethod
if method() is not None:
File "/Users/maurits/community/plone-coredev/6.2/src/plone.autoinclude/test-packages/example.basetestpackage/src/example/basetestpackage/integration_base.py", line 141, in test_configure
self.files_have_been_loaded(self.configure_files)
File "/Users/maurits/community/plone-coredev/6.2/src/plone.autoinclude/test-packages/example.basetestpackage/src/example/basetestpackage/integration_base.py", line 108, in files_have_been_loaded
self.assertIn(package_context.path(filename), self.context._seen_files)
File "/usr/local/Cellar/[email protected]/3.12.8/Frameworks/Python.framework/Versions/3.12/lib/python3.12/unittest/case.py", line 1152, in assertIn
self.fail(self._formatMessage(msg, standardMsg))
File "/usr/local/Cellar/[email protected]/3.12.8/Frameworks/Python.framework/Versions/3.12/lib/python3.12/unittest/case.py", line 715, in fail
raise self.failureException(msg)
AssertionError: '/Users/maurits/community/plone-coredev/6.2/src/plone.autoinclude/test-packages/example.zopeaddon/src/example/zopeaddon/configure.zcml' not found in {'/Users/maurits/community/plone-coredev/6.2/src/plone.autoinclude/test-packages/example.zopeintegration/src/example/zopeintegration/meta.zcml', '/Users/maurits/community/plone-coredev/6.2/src/plone.autoinclude/src/plone/autoinclude/meta.zcml', '/Users/maurits/community/plone-coredev/6.2/src/plone.autoinclude/test-packages/example.different2/src/example/somethingelse2/configure.zcml', '/Users/maurits/community/plone-coredev/6.2/src/plone.autoinclude/test-packages/example.zopeintegration/src/example/zopeintegration/configure.zcml', '/Users/maurits/community/plone-coredev/6.2/src/plone.autoinclude/test-packages/example.different2/src/example/somethingelse2/meta.zcml'}
So this does not quite work, and my own PR #30 does.
But indeed we should move away from pkg_resources
, so I appreciate your effort, and we should continue this at some point in the near future.
Fixes #25
Refs. plone/Products.CMFPlone#4126