Fixed #30137 -- Replaced OSError aliases with the canonical OSError.

Used more specific errors (e.g. FileExistsError) as appropriate.
This commit is contained in:
Jon Dufresne 2019-01-28 07:01:35 -08:00 committed by Tim Graham
parent 7444f32527
commit 7785e03ba8
33 changed files with 60 additions and 69 deletions

View file

@ -191,11 +191,11 @@ class FileSystemLoaderTests(SimpleTestCase):
tmppath = os.path.join(tmpdir, tmpfile.name)
os.chmod(tmppath, 0o0222)
with self.set_dirs([tmpdir]):
with self.assertRaisesMessage(IOError, 'Permission denied'):
with self.assertRaisesMessage(PermissionError, 'Permission denied'):
self.engine.get_template(tmpfile.name)
def test_notafile_error(self):
with self.assertRaises(IOError):
with self.assertRaises(IsADirectoryError):
self.engine.get_template('first')