Decreased length of test image data

This commit is contained in:
Andrew Murray 2020-06-20 09:48:55 +10:00
parent f99e0b824b
commit 3e9068a345

View File

@ -707,7 +707,7 @@ class TestFileJpeg:
assert im.info["icc_profile"] == b"profile" assert im.info["icc_profile"] == b"profile"
def test_reading_not_whole_file_for_define_it_type(self): def test_reading_not_whole_file_for_define_it_type(self):
size = 1024 ** 2 size = 4097
buffer = BytesIO(b"\xFF" * size) # Many xFF bytes buffer = BytesIO(b"\xFF" * size) # Many xFF bytes
buffer.max_pos = 0 buffer.max_pos = 0
orig_read = buffer.read orig_read = buffer.read
@ -721,10 +721,8 @@ class TestFileJpeg:
with pytest.raises(OSError): with pytest.raises(OSError):
Image.open(buffer) Image.open(buffer)
# Only small part of file has been read. # Assert the entire file has not been read
# The upper limit of max_pos (8Kb) was chosen experimentally assert 0 < buffer.max_pos < size
# and increased approximately twice.
assert 0 < buffer.max_pos < 8 * 1024
@pytest.mark.skipif(not is_win32(), reason="Windows only") @pytest.mark.skipif(not is_win32(), reason="Windows only")