Skip to content
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

[v1.27.0] Tests: IPFS download #502

Merged
merged 6 commits into from
Dec 27, 2022
Merged

[v1.27.0] Tests: IPFS download #502

merged 6 commits into from
Dec 27, 2022

Conversation

Karrenbelt
Copy link

@Karrenbelt Karrenbelt commented Dec 24, 2022

Proposed changes

Added test (and fix) for handling a IPFS that points to a single file rather than a directory.

partially addresses #501
#480 will be revisited and stacked on top of this PR.

Fixes

If it fixes a bug or resolves a feature request, be sure to link to that issue.

Types of changes

What types of changes does your code introduce to agents-aea?
Put an x in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

Put an x in the boxes that apply.

  • I have read the CONTRIBUTING doc
  • I am making a pull request against the develop branch (left side). Also you should start your branch off our develop.
  • Lint and unit tests pass locally with my changes and CI passes too
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked that code coverage does not decrease.
  • I have added necessary documentation (if appropriate)
  • Any dependent changes have been merged and published in downstream modules

Further comments

If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...


if is_dir:
assert len(all_new_paths) == 4
assert not any(self.some_ipfs_hash in str(p) for p in all_new_paths)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because we default to fix_path = True

"shutil.copytree"
"shutil.copy"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this mock was hiding an issue

@codecov-commenter
Copy link

Codecov Report

Base: 90.29% // Head: 90.30% // Increases project coverage by +0.00% 🎉

Coverage data is based on head (67ac9a1) compared to base (8c684c4).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #502   +/-   ##
=======================================
  Coverage   90.29%   90.30%           
=======================================
  Files         352      352           
  Lines       28700    28702    +2     
=======================================
+ Hits        25916    25920    +4     
+ Misses       2784     2782    -2     
Flag Coverage Δ
unittests 90.30% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
plugins/aea-cli-ipfs/aea_cli_ipfs/ipfs_utils.py 100.00% <100.00%> (+0.58%) ⬆️
aea/package_manager/v1.py 100.00% <0.00%> (+0.64%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@Karrenbelt Karrenbelt changed the title Tests: IPFS download [v1.27.0] Tests: IPFS download Dec 24, 2022
Comment on lines -339 to +342
shutil.copytree(download_path, downloaded_path)
if download_path.is_dir():
shutil.copytree(download_path, downloaded_path)
else:
shutil.copy(download_path, downloaded_path)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

immediate fix, cleaned up in #480

Comment on lines -357 to +360
if fix_path:
if fix_path and Path(downloaded_path).is_dir():
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

@Karrenbelt Karrenbelt requested a review from solarw December 25, 2022 14:56
Copy link
Collaborator

@solarw solarw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@DavidMinarsch DavidMinarsch merged commit de57471 into main Dec 27, 2022
@DavidMinarsch DavidMinarsch deleted the tests/ipfs_download branch December 27, 2022 09:34
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.

4 participants