Skip to content

Fix Python 3 compatibility and flake8 violations in tests#23

Closed
Copilot wants to merge 4 commits intochas/update-pythonfrom
copilot/sub-pr-22
Closed

Fix Python 3 compatibility and flake8 violations in tests#23
Copilot wants to merge 4 commits intochas/update-pythonfrom
copilot/sub-pr-22

Conversation

Copy link
Copy Markdown

Copilot AI commented Dec 8, 2025

  • Analyze test failure in test_valid_activity_id
  • Fix resource creation order to prevent duplicate ID errors
  • Remove unused resource variable to fix lint error
  • Verify fix with local linting
  • Run code review
  • Run security checks

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

- Replace 'import mock' with 'from unittest import mock' in test files
- Fix isinstance() check in test_actions.py
- Remove extra blank lines in test_validators.py
- Fix indentation in setup.py

Co-authored-by: ChasNelson1990 <[email protected]>
Copilot AI changed the title [WIP] Fix failing linters and tests in GitHub actions Fix Python 3 compatibility and flake8 violations in tests Dec 8, 2025
Copilot AI requested a review from ChasNelson1990 December 8, 2025 16:07
@ChasNelson1990
Copy link
Copy Markdown
Member

@copilot this tests fail with:

FAILED ckanext/fork/tests/test_validators.py::TestValidFork::test_valid_activity_id[None-result0] - ckan.logic.ValidationError: None - {'resources': [{'id': ['Resource id already exists.']}]}
FAILED ckanext/fork/tests/test_validators.py::TestValidFork::test_valid_activity_id[-result1] - ckan.logic.ValidationError: None - {'resources': [{'id': ['Resource id already exists.']}]}
FAILED ckanext/fork/tests/test_validators.py::TestValidFork::test_valid_activity_id[{good_object_id}-result2] - ckan.logic.ValidationError: None - {'resources': [{'id': ['Resource id already exists.']}]}
FAILED ckanext/fork/tests/test_validators.py::TestValidFork::test_valid_activity_id[bad-object-id-result3] - ckan.logic.ValidationError: None - {'resources': [{'id': ['Resource id already exists.']}]}

- Create dataset before resource to avoid duplicate ID error
- Pass package_id when creating resource (following conftest.py pattern)

Co-authored-by: ChasNelson1990 <[email protected]>
Copy link
Copy Markdown
Author

Copilot AI commented Dec 8, 2025

@copilot this tests fail with:

FAILED ckanext/fork/tests/test_validators.py::TestValidFork::test_valid_activity_id[None-result0] - ckan.logic.ValidationError: None - {'resources': [{'id': ['Re...

Fixed in commit 85d8a0d. The issue was the order of resource/dataset creation - the test was creating a resource first, then trying to add it to a new dataset, which caused a duplicate ID error. Now it follows the correct pattern: create dataset first, then create resource with package_id parameter.

@ChasNelson1990
Copy link
Copy Markdown
Member

@copilot fix the lint issues

Fixes flake8 lint error for unused variable

Co-authored-by: ChasNelson1990 <[email protected]>
Copy link
Copy Markdown
Author

Copilot AI commented Dec 8, 2025

@copilot fix the lint issues

Fixed in commit 38b9725. Removed the unused resource variable that was causing the flake8 lint error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants