Skip to content

Commit 5fdd51f

Browse files
committed
Fix mypy unreachable-statement error in PuffinWriter exception test
Restructure test_puffin_writer_does_not_write_on_exception to use try/except instead of nesting an unconditional raise inside pytest.raises, which mypy's warn-unreachable flagged as unreachable. Co-authored-by: Isaac
1 parent 2949666 commit 5fdd51f

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

tests/table/test_puffin.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,15 @@ def test_puffin_writer_empty(tmp_path: Path) -> None:
144144

145145

146146
def test_puffin_writer_does_not_write_on_exception(tmp_path: Path) -> None:
147-
puffin_path = tmp_path / "test.puffin"
148-
output_file = PyArrowFileIO().new_output(str(puffin_path))
147+
output_file = PyArrowFileIO().new_output(str(tmp_path / "test.puffin"))
148+
writer = PuffinWriter(output_file)
149149

150-
with pytest.raises(ValueError, match="boom"):
151-
with PuffinWriter(output_file) as writer:
150+
try:
151+
with writer:
152152
writer.add_blob(DeletionVector.from_positions("file.parquet", [1]).to_blob())
153153
raise ValueError("boom")
154+
except ValueError:
155+
pass
154156

155157
assert writer.closed
156158
# The body raised, so no half-populated file should have been written.

0 commit comments

Comments
 (0)