Fix lint errors and dependency compatibility issues in test workflow#14
Conversation
- Fixed E721 flake8 error by using isinstance() instead of type comparison - Removed --user root from container options which was causing permission issues Co-authored-by: ChasNelson1990 <7795189+ChasNelson1990@users.noreply.github.com>
- Restored --user root option to fix checkout permissions - Added harvester initdb command to initialize harvest tables Co-authored-by: ChasNelson1990 <7795189+ChasNelson1990@users.noreply.github.com>
- Fixed dependency compatibility issue between pyOpenSSL and cryptography - Added version constraints to ensure compatible library versions Co-authored-by: ChasNelson1990 <7795189+ChasNelson1990@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot the "Setup Extension" step fails with: Traceback (most recent call last):
File "/usr/local/bin/ckan", line 8, in <module>
sys.exit(ckan())
File "/usr/local/lib/python3.9/site-packages/click/core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/click/core.py", line 781, in main
with self.make_context(prog_name, args, **extra) as ctx:
File "/usr/local/lib/python3.9/site-packages/click/core.py", line 700, in make_context
self.parse_args(ctx, args)
File "/srv/app/src/ckan/ckan/cli/cli.py", line 116, in parse_args
result = super(ExtendableGroup, self).parse_args(ctx, args)
File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1212, in parse_args
rest = Command.parse_args(self, ctx, args)
File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1048, in parse_args
value, args = param.handle_parse_result(ctx, opts, args)
File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1630, in handle_parse_result
value = invoke_param_callback(self.callback, ctx, self, value)
File "/usr/local/lib/python3.9/site-packages/click/core.py", line 123, in invoke_param_callback
return callback(ctx, param, value)
File "/srv/app/src/ckan/ckan/cli/cli.py", line 126, in _init_ckan_config
_add_ctx_object(ctx, value)
File "/srv/app/src/ckan/ckan/cli/cli.py", line 135, in _add_ctx_object
ctx.obj = CtxObject(path)
File "/srv/app/src/ckan/ckan/cli/cli.py", line 57, in __init__
self.app = make_app(self.config)
File "/srv/app/src/ckan/ckan/config/middleware/__init__.py", line 56, in make_app
load_environment(conf)
File "/srv/app/src/ckan/ckan/config/environment.py", line 123, in load_environment
p.load_all()
File "/srv/app/src/ckan/ckan/plugins/core.py", line 165, in load_all
load(*plugins)
File "/srv/app/src/ckan/ckan/plugins/core.py", line 179, in load
service = _get_service(plugin)
File "/srv/app/src/ckan/ckan/plugins/core.py", line 281, in _get_service
return plugin.load()(name=plugin_name)
File "/usr/local/lib/python3.9/site-packages/pkg_resources/__init__.py", line 2778, in load
return self.resolve()
File "/usr/local/lib/python3.9/site-packages/pkg_resources/__init__.py", line 2784, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/__w/ckanext-harvest/ckanext-harvest/ckanext/harvest/harvesters/__init__.py", line 1, in <module>
from ckanext.harvest.harvesters.ckanharvester import CKANHarvester
File "/__w/ckanext-harvest/ckanext-harvest/ckanext/harvest/harvesters/ckanharvester.py", line 7, in <module>
from urllib3.contrib import pyopenssl
File "/usr/local/lib/python3.9/site-packages/urllib3/contrib/pyopenssl.py", line 50, in <module>
import OpenSSL.SSL
File "/usr/local/lib/python3.9/site-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import crypto, SSL
File "/usr/local/lib/python3.9/site-packages/OpenSSL/crypto.py", line 1550, in <module>
class X509StoreFlags(object):
File "/usr/local/lib/python3.9/site-packages/OpenSSL/crypto.py", line 1568, in X509StoreFlags
NOTIFY_POLICY = _lib.X509_V_FLAG_NOTIFY_POLICY
AttributeError: module 'lib' has no attribute 'X509_V_FLAG_NOTIFY_POLICY' |
- Updated pyOpenSSL from 18.0.0 to >=23.2.0 in requirements.txt - Added cryptography>=41.0.0,<43.0.0 constraint to requirements.txt - Removed redundant version pins from workflow (now in requirements.txt) Co-authored-by: ChasNelson1990 <7795189+ChasNelson1990@users.noreply.github.com>
... The issue was caused by
This should resolve the Setup Extension traceback. |
|
@copilot The Setup Extension step fails with: Traceback (most recent call last):
File "/usr/local/bin/ckan", line 8, in <module>
sys.exit(ckan())
File "/usr/local/lib/python3.9/site-packages/click/core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/click/core.py", line 781, in main
with self.make_context(prog_name, args, **extra) as ctx:
File "/usr/local/lib/python3.9/site-packages/click/core.py", line 700, in make_context
self.parse_args(ctx, args)
File "/srv/app/src/ckan/ckan/cli/cli.py", line 116, in parse_args
result = super(ExtendableGroup, self).parse_args(ctx, args)
File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1212, in parse_args
rest = Command.parse_args(self, ctx, args)
File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1048, in parse_args
value, args = param.handle_parse_result(ctx, opts, args)
File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1630, in handle_parse_result
value = invoke_param_callback(self.callback, ctx, self, value)
File "/usr/local/lib/python3.9/site-packages/click/core.py", line 123, in invoke_param_callback
return callback(ctx, param, value)
File "/srv/app/src/ckan/ckan/cli/cli.py", line 126, in _init_ckan_config
_add_ctx_object(ctx, value)
File "/srv/app/src/ckan/ckan/cli/cli.py", line 135, in _add_ctx_object
ctx.obj = CtxObject(path)
File "/srv/app/src/ckan/ckan/cli/cli.py", line 57, in __init__
self.app = make_app(self.config)
File "/srv/app/src/ckan/ckan/config/middleware/__init__.py", line 56, in make_app
load_environment(conf)
File "/srv/app/src/ckan/ckan/config/environment.py", line 123, in load_environment
p.load_all()
File "/srv/app/src/ckan/ckan/plugins/core.py", line 165, in load_all
load(*plugins)
File "/srv/app/src/ckan/ckan/plugins/core.py", line 179, in load
service = _get_service(plugin)
File "/srv/app/src/ckan/ckan/plugins/core.py", line 281, in _get_service
return plugin.load()(name=plugin_name)
File "/usr/local/lib/python3.9/site-packages/pkg_resources/__init__.py", line 2778, in load
return self.resolve()
File "/usr/local/lib/python3.9/site-packages/pkg_resources/__init__.py", line 2784, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/__w/ckanext-harvest/ckanext-harvest/ckanext/harvest/harvesters/__init__.py", line 1, in <module>
from ckanext.harvest.harvesters.ckanharvester import CKANHarvester
File "/__w/ckanext-harvest/ckanext-harvest/ckanext/harvest/harvesters/ckanharvester.py", line 7, in <module>
from urllib3.contrib import pyopenssl
File "/usr/local/lib/python3.9/site-packages/urllib3/contrib/pyopenssl.py", line 53, in <module>
from cryptography.hazmat.backends.openssl.x509 import _Certificate
ModuleNotFoundError: No module named 'cryptography.hazmat.backends.openssl.x509' |
- Removed urllib3.contrib.pyopenssl import and inject_into_urllib3() call - This fixes compatibility with cryptography>=42.0.0 - Modern Python and urllib3 have built-in SSL/TLS support Co-authored-by: ChasNelson1990 <7795189+ChasNelson1990@users.noreply.github.com>
... The Setup Extension failure was caused by Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot the tests fail with: FAILED ckanext/harvest/tests/harvesters/test_ckanharvester.py::TestCkanHarvester::test_get_content_handles_request_exception - ModuleNotFoundError: No module named 'ckanext.harvest.harvesters.ckanharvester.pyopenssl'; 'ckanext.harvest.harvesters.ckanharvester' is not a package
FAILED ckanext/harvest/tests/harvesters/test_ckanharvester.py::TestCkanHarvester::test_get_content_handles_http_error - ModuleNotFoundError: No module named 'ckanext.harvest.harvesters.ckanharvester.pyopenssl'; 'ckanext.harvest.harvesters.ckanharvester' is not a package
FAILED ckanext/harvest/tests/test_action.py::TestHarvestSourceActionUpdate::test_update - ckan.logic.ValidationError: None - {'source_type': ["Unknown harvester type: test. Registered types: ['test-for-action']"]}
FAILED ckanext/harvest/tests/test_blueprint.py::TestBlueprint::test_new_form_is_rendered - AttributeError: 'TestBlueprint' object has no attribute 'extra_environ'
FAILED ckanext/harvest/tests/test_blueprint.py::TestBlueprint::test_edit_form_is_rendered - AttributeError: 'TestBlueprint' object has no attribute 'extra_environ'
FAILED ckanext/harvest/tests/test_blueprint.py::TestBlueprint::test_source_page_rendered - AttributeError: 'TestBlueprint' object has no attribute 'extra_environ'
FAILED ckanext/harvest/tests/test_blueprint.py::TestBlueprint::test_about_page_rendered - AttributeError: 'TestBlueprint' object has no attribute 'extra_environ'
FAILED ckanext/harvest/tests/test_blueprint.py::TestBlueprint::test_job_show_page_rendered - AttributeError: 'TestBlueprint' object has no attribute 'extra_environ' |
- Removed @patch decorators for pyopenssl.inject_into_urllib3 in test_ckanharvester.py - These mocks are no longer needed since we removed the pyopenssl dependency Co-authored-by: ChasNelson1990 <7795189+ChasNelson1990@users.noreply.github.com>
Fixed the pyopenssl-related test failures in commit 57db72f by removing the obsolete The remaining failures (
These were not introduced by my changes. |
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.