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

fix: unintended unclosed status when exception #622

Merged
merged 4 commits into from
Oct 13, 2024

Conversation

miurahr
Copy link
Owner

@miurahr miurahr commented Oct 13, 2024

Pull request type

select from below

  • Bug fix

Which ticket is resolved?

What does this PR change?

  • Removal of fileRefCnt check
  • Add test case to check fp.close when exception

Other information

@miurahr miurahr added the bug Something isn't working label Oct 13, 2024
- Removal of fileRefCnt check
- Add test case to check fp.close when exception
- remove duplicated test case

Signed-off-by: Hiroshi Miura <[email protected]>
@miurahr miurahr force-pushed the topic/miurahr/fix-exception-handling-fp-close branch from 7e4238c to ba11286 Compare October 13, 2024 07:09
@miurahr
Copy link
Owner Author

miurahr commented Oct 13, 2024

I have added the test case

@pytest.mark.basic
def test_digests_data_corrupted():
    arcfile = os.path.join(testdata_path, "data_corrupted.7z")
    with pytest.raises(_lzma.LZMAError):
        with py7zr.SevenZipFile(arcfile) as archive:
            archive.testzip()
    assert archive.fp.closed

This is the regression test of the case #597

@miurahr miurahr added this to the v1.0.0 - General release milestone Oct 13, 2024
Signed-off-by: Hiroshi Miura <[email protected]>
@miurahr miurahr merged commit 4f0fec8 into master Oct 13, 2024
24 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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant