Apparently Python 3.12 no longer raises FileNotFoundError when closing a deleted file

Fixes #6360 (I hope) dont have time to actually test with pre-release
python builds
This commit is contained in:
Kovid Goyal 2023-06-14 08:06:47 +05:30
parent b96a261a35
commit 4c5f4c4baf
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C

View file

@ -8,6 +8,7 @@
import unittest
import zlib
from base64 import standard_b64decode, standard_b64encode
from contextlib import suppress
from dataclasses import dataclass
from io import BytesIO
from itertools import cycle
@ -364,9 +365,9 @@ def test_load_images(self):
self.assertTrue(os.path.exists(f.name))
f.seek(0), f.truncate(), f.write(compressed_random_data), f.flush()
sl(f.name, s=24, v=32, t='t', o='z', expecting_data=random_data)
self.assertRaises(
FileNotFoundError, f.close
) # check that file was deleted
self.assertFalse(os.path.exists(f.name), f'Temp file at {f.name} was not deleted')
with suppress(FileNotFoundError):
f.close()
# Test loading from POSIX SHM
name = '/kitty-test-shm'