mirror of
https://github.com/python/cpython.git
synced 2024-11-28 12:31:14 +08:00
closes bpo-34594: Don't hardcode errno values in the tests. (GH-9076)
This commit is contained in:
parent
3e2b29dccc
commit
b03c2c5190
@ -67,8 +67,6 @@ class TestSpwdNonRoot(unittest.TestCase):
|
||||
spwd.getspnam(name)
|
||||
except KeyError as exc:
|
||||
self.skipTest("spwd entry %r doesn't exist: %s" % (name, exc))
|
||||
else:
|
||||
self.assertEqual(str(cm.exception), '[Errno 13] Permission denied')
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
@ -5,6 +5,7 @@ Glossary:
|
||||
"""
|
||||
from unittest import TestCase, mock
|
||||
from unittest import mock
|
||||
import errno
|
||||
import tabnanny
|
||||
import tokenize
|
||||
import tempfile
|
||||
@ -232,7 +233,8 @@ class TestCheck(TestCase):
|
||||
def test_when_no_file(self):
|
||||
"""A python file which does not exist actually in system."""
|
||||
path = 'no_file.py'
|
||||
err = f"{path!r}: I/O Error: [Errno 2] No such file or directory: {path!r}\n"
|
||||
err = f"{path!r}: I/O Error: [Errno {errno.ENOENT}] " \
|
||||
f"No such file or directory: {path!r}\n"
|
||||
self.verify_tabnanny_check(path, err=err)
|
||||
|
||||
def test_errored_directory(self):
|
||||
|
@ -0,0 +1 @@
|
||||
Fix usage of hardcoded ``errno`` values in the tests.
|
Loading…
Reference in New Issue
Block a user