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

Treat zero byte stream as a file. #551

Merged
merged 19 commits into from
Mar 2, 2024
Merged

Conversation

diedmon
Copy link
Contributor

@diedmon diedmon commented Dec 17, 2023

Ref to issue #549 and issue #398. This pull request will fix those issues by treating zero byte stream as a file.

Treat zero byte stream as a file.
@diedmon diedmon closed this Dec 17, 2023
@diedmon diedmon reopened this Dec 17, 2023
@miurahr miurahr self-requested a review December 17, 2023 13:21
@miurahr
Copy link
Owner

miurahr commented Dec 17, 2023

@diedmon could you add or enable unit test which reproduce the case a PR fixed?

@diedmon
Copy link
Contributor Author

diedmon commented Dec 17, 2023

@miurahr I don't how to enable unit test, but I attached the test file in the attachment.

test_empty_stream.zip

@miurahr miurahr added the bug Something isn't working label Jan 26, 2024
@miurahr
Copy link
Owner

miurahr commented Jan 27, 2024

Please put your test in test_archive.py/tests.

You need to use tmp_path fixture to make target file in temporary folder.
like def test_something(tmp_path):

@miurahr miurahr added the for archiving Issue on archiving, compression or encryption label Jan 27, 2024
@diedmon
Copy link
Contributor Author

diedmon commented Jan 28, 2024

Hi, @miurahr, thank you for your guide. I have updated the test_archive.py.

@miurahr
Copy link
Owner

miurahr commented Jan 29, 2024

tox: check
check: commands[0]> flake8 py7zr tests
tests/test_archive.py:1170:3: BLK100 Black would make changes.
tests/test_archive.py:1170:3: E111 indentation is not a multiple of 4
tests/test_archive.py:1171:43: E231 missing whitespace after ','
tests/test_archive.py:1172:7: E111 indentation is not a multiple of 4
tests/test_archive.py:1172:31: E231 missing whitespace after ','
tests/test_archive.py:1173:3: E722 do not use bare 'except'
tests/test_archive.py:1173:3: E111 indentation is not a multiple of 4

@diedmon
Copy link
Contributor Author

diedmon commented Jan 31, 2024

Thank you for your comment, I have corrected the mistakes.

tests/test_archive.py Outdated Show resolved Hide resolved
tests/test_archive.py Outdated Show resolved Hide resolved
@diedmon
Copy link
Contributor Author

diedmon commented Feb 1, 2024

Thanks for your comment, I didn't realize that pytest can handle the exception properly without try and except. Also, please note that since a zero byte stream is treated as a file, it won't have the "emptystream" attribute anymore.

@diedmon diedmon requested a review from miurahr February 1, 2024 12:04
tests/test_archive.py Outdated Show resolved Hide resolved
tests/test_archive.py Outdated Show resolved Hide resolved
diedmon and others added 2 commits February 11, 2024 22:08
Co-authored-by: Hiroshi Miura <miurahr@linux.com>
Co-authored-by: Hiroshi Miura <miurahr@linux.com>
@miurahr miurahr merged commit 6b253d1 into miurahr:master Mar 2, 2024
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working for archiving Issue on archiving, compression or encryption
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants