File tree Expand file tree Collapse file tree 3 files changed +7
-2
lines changed Expand file tree Collapse file tree 3 files changed +7
-2
lines changed Original file line number Diff line number Diff line change
1
+ import errno
1
2
import os
2
3
import unittest
3
4
from test import support
@@ -68,7 +69,8 @@ def test_getspnam_exception(self):
68
69
except KeyError as exc :
69
70
self .skipTest ("spwd entry %r doesn't exist: %s" % (name , exc ))
70
71
else :
71
- self .assertEqual (str (cm .exception ), '[Errno 13] Permission denied' )
72
+ self .assertEqual (str (cm .exception ),
73
+ f'[Errno { errno .EACCES } ] Permission denied' )
72
74
73
75
74
76
if __name__ == "__main__" :
Original file line number Diff line number Diff line change 5
5
"""
6
6
from unittest import TestCase , mock
7
7
from unittest import mock
8
+ import errno
8
9
import tabnanny
9
10
import tokenize
10
11
import tempfile
@@ -232,7 +233,8 @@ def test_when_nannynag_error(self):
232
233
def test_when_no_file (self ):
233
234
"""A python file which does not exist actually in system."""
234
235
path = 'no_file.py'
235
- err = f"{ path !r} : I/O Error: [Errno 2] No such file or directory: { path !r} \n "
236
+ err = f"{ path !r} : I/O Error: [Errno { errno .ENOENT } ] " \
237
+ f"No such file or directory: { path !r} \n "
236
238
self .verify_tabnanny_check (path , err = err )
237
239
238
240
def test_errored_directory (self ):
Original file line number Diff line number Diff line change
1
+ Fix usage of hardcoded ``errno `` values in the tests.
You can’t perform that action at this time.
0 commit comments