Use errno instead of hard-coding error 2

This commit is contained in:
Erik Johnson 2018-06-13 01:11:55 -05:00
parent ff63f36932
commit e6a4744f85
No known key found for this signature in database
GPG key ID: 5E5583C437808F3F

View file

@ -15,6 +15,7 @@
# pylint: disable=unused-import,function-redefined,blacklisted-module,blacklisted-external-module
from __future__ import absolute_import
import errno
import fnmatch
import sys
@ -203,7 +204,7 @@ def mock_open(mock=None, read_data='', match=None):
for pat in match:
if fnmatch.fnmatch(name, pat):
return DEFAULT
raise IOError(2, 'No such file or directory', name)
raise IOError(errno.ENOENT, 'No such file or directory', name)
mock.side_effect = fopen_side_effect