Skip to content

Commit

Permalink
Add more truncation tests
Browse files Browse the repository at this point in the history
  • Loading branch information
maxnoe committed Sep 8, 2023
1 parent a27590a commit fd53428
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tests/test_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ def test_particle_no_parse():



def test_truncated(tmp_path):
@pytest.mark.parametrize("size", (273 * 10, 5000, 273 * 2))
def test_truncated(tmp_path, size):
'''Test we raise a meaningful error for a truncated file
Truncated files might happen if corsika crashes or the disk is full.
Expand All @@ -100,7 +101,7 @@ def test_truncated(tmp_path):

with open("tests/resources/corsika757_particle", "rb") as f:
with path.open("wb") as out:
out.write(f.read(273 * 10))
out.write(f.read(size))

with pytest.raises(IOError, match="seems to be truncated"):
with CorsikaParticleFile(path) as f:
Expand Down

0 comments on commit fd53428

Please sign in to comment.