mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #17169: Restore errno in tempfile exceptions.
This commit is contained in:
commit
26cab56542
2 changed files with 13 additions and 5 deletions
|
@ -1,5 +1,6 @@
|
|||
# tempfile.py unit tests.
|
||||
import tempfile
|
||||
import errno
|
||||
import os
|
||||
import signal
|
||||
import sys
|
||||
|
@ -963,8 +964,9 @@ class TestTemporaryDirectory(BaseTestCase):
|
|||
# (noted as part of Issue #10188)
|
||||
with tempfile.TemporaryDirectory() as nonexistent:
|
||||
pass
|
||||
with self.assertRaises(OSError):
|
||||
with self.assertRaises(FileNotFoundError) as cm:
|
||||
tempfile.TemporaryDirectory(dir=nonexistent)
|
||||
self.assertEqual(cm.exception.errno, errno.ENOENT)
|
||||
|
||||
def test_explicit_cleanup(self):
|
||||
# A TemporaryDirectory is deleted when cleaned up
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue