Skip to content

Commit b03c2c5

Browse files
ZackerySpytzbenjaminp
authored andcommitted
closes bpo-34594: Don't hardcode errno values in the tests. (GH-9076)
1 parent 3e2b29d commit b03c2c5

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

Lib/test/test_spwd.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,6 @@ def test_getspnam_exception(self):
6767
spwd.getspnam(name)
6868
except KeyError as exc:
6969
self.skipTest("spwd entry %r doesn't exist: %s" % (name, exc))
70-
else:
71-
self.assertEqual(str(cm.exception), '[Errno 13] Permission denied')
7270

7371

7472
if __name__ == "__main__":

Lib/test/test_tabnanny.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"""
66
from unittest import TestCase, mock
77
from unittest import mock
8+
import errno
89
import tabnanny
910
import tokenize
1011
import tempfile
@@ -232,7 +233,8 @@ def test_when_nannynag_error(self):
232233
def test_when_no_file(self):
233234
"""A python file which does not exist actually in system."""
234235
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"
236238
self.verify_tabnanny_check(path, err=err)
237239

238240
def test_errored_directory(self):
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix usage of hardcoded ``errno`` values in the tests.

0 commit comments

Comments
 (0)