-
Notifications
You must be signed in to change notification settings - Fork 71
Add md5 hash property to GSPath (#483) #490
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* feat: added md5_hash property in GSClient._get_metadata, added md5 property inside GSPath * docs: update supported methods and properties table in root README * chore: running make format * feat: updating code since linter wouldnt let me do it all in one line like the etag property * chore: rename variable to match the variable naming in GSPath.stat() * feat: update LocalGSPath to mimic local/implementations/azure.py for md5 property * feat: updating MockBlob to include md5_hash property * docs: updated history.md * chore: reverting to pre PEP604 syntax * test: added md5 test case, update MockBlob to take its value from an environment variable * chore: applying format and lint
Contributor
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #490 +/- ##
========================================
- Coverage 94.0% 93.8% -0.2%
========================================
Files 23 23
Lines 1788 1797 +9
========================================
+ Hits 1682 1687 +5
- Misses 106 110 +4
|
Member
Author
|
@fafnirZ The hashes do not match in the live tests. Do you know why that would be? =================================== FAILURES ===================================
_______ test_md5_property[hello world-5eb63bbbe01eeed093cb22bb8f5acdc3] ________
[gw1] linux -- Python 3.11.10 /home/runner/.venv/bin/python
content = 'hello world', expected_hash = '5eb63bbbe01eeed093cb22bb8f5acdc3'
gs_rig = <tests.conftest.CloudProviderTestRig object at 0x7f4eacb26e10>
monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7f4ead623e50>
@pytest.mark.parametrize(
"content, expected_hash",
[
("hello world", "5eb63bbbe01eeed093cb22bb8f5acdc3"),
("another test case", "4f8182cd9856777ebe3c4f5dc58dacea"),
],
)
def test_md5_property(content, expected_hash, gs_rig, monkeypatch):
# if USE_LIVE_CLOUD this doesnt have any effect
monkeypatch.setenv("MOCK_EXPECTED_MD5_HASH", expected_hash)
p: GSPath = gs_rig.create_cloud_path("dir_0/file0_0.txt")
p.write_text(content)
> assert p.md5 == expected_hash
E AssertionError: assert 'XrY7u+Ae7tCTyyK7j1rNww==' == '5eb63bbbe01eeed093cb22bb8f5acdc3'
E
E - 5eb63bbbe01eeed093cb22bb8f5acdc3
E + XrY7u+Ae7tCTyyK7j1rNww==
tests/test_gs_specific.py:67: AssertionError
---------------------------- Captured stdout setup -----------------------------
Test directory name is: RkUnPnTDZxRHxQeE72hydb-test_gs_specific-test_md5_property
____ test_md5_property[another test case-4f8182cd9856777ebe3c4f5dc58dacea] _____
[gw1] linux -- Python 3.11.10 /home/runner/.venv/bin/python
content = 'another test case'
expected_hash = '4f8182cd9856777ebe3c4f5dc58dacea'
gs_rig = <tests.conftest.CloudProviderTestRig object at 0x7f4ead3eca10>
monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7f4eace25650>
@pytest.mark.parametrize(
"content, expected_hash",
[
("hello world", "5eb63bbbe01eeed093cb22bb8f5acdc3"),
("another test case", "4f8182cd9856777ebe3c4f5dc58dacea"),
],
)
def test_md5_property(content, expected_hash, gs_rig, monkeypatch):
# if USE_LIVE_CLOUD this doesnt have any effect
monkeypatch.setenv("MOCK_EXPECTED_MD5_HASH", expected_hash)
p: GSPath = gs_rig.create_cloud_path("dir_0/file0_0.txt")
p.write_text(content)
> assert p.md5 == expected_hash
E AssertionError: assert 'T4GCzZhWd36+PE9dxY2s6g==' == '4f8182cd9856777ebe3c4f5dc58dacea'
E
E - 4f8182cd9856777ebe3c4f5dc58dacea
E + T4GCzZhWd36+PE9dxY2s6g==
tests/test_gs_specific.py:67: AssertionError |
Contributor
Member
Author
|
Thanks @fafnirZ, I just grabbed the change directly. Will merge if tests pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Live tests for #483