(self)
| 1601 | self.assertEqual(os.listdir(dir), []) |
| 1602 | |
| 1603 | def test_unexpected_error(self): |
| 1604 | dir = tempfile.mkdtemp() |
| 1605 | self.addCleanup(os_helper.rmtree, dir) |
| 1606 | with mock.patch('tempfile._O_TMPFILE_WORKS', False), \ |
| 1607 | mock.patch('os.unlink') as mock_unlink, \ |
| 1608 | mock.patch('os.open') as mock_open, \ |
| 1609 | mock.patch('os.close') as mock_close: |
| 1610 | mock_unlink.side_effect = KeyboardInterrupt() |
| 1611 | with self.assertRaises(KeyboardInterrupt): |
| 1612 | tempfile.TemporaryFile(dir=dir) |
| 1613 | mock_close.assert_called() |
| 1614 | self.assertEqual(os.listdir(dir), []) |
| 1615 | |
| 1616 | |
| 1617 | # Helper for test_del_on_shutdown |
nothing calls this directly
no test coverage detected