summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZackery Spytz <zspytz@gmail.com>2018-09-06 18:43:30 (GMT)
committerBenjamin Peterson <benjamin@python.org>2018-09-06 18:43:30 (GMT)
commitb03c2c51909e3b5b5966d86a2829b5ddf2d496aa (patch)
tree73cefb81f57eba929c6710e3744bb7c36b45ea0d
parent3e2b29dccc3ca9fbc418bfa312ad655782e250f2 (diff)
downloadcpython-b03c2c51909e3b5b5966d86a2829b5ddf2d496aa.zip
cpython-b03c2c51909e3b5b5966d86a2829b5ddf2d496aa.tar.gz
cpython-b03c2c51909e3b5b5966d86a2829b5ddf2d496aa.tar.bz2
closes bpo-34594: Don't hardcode errno values in the tests. (GH-9076)
-rw-r--r--Lib/test/test_spwd.py2
-rw-r--r--Lib/test/test_tabnanny.py4
-rw-r--r--Misc/NEWS.d/next/Tests/2018-09-05-23-50-21.bpo-34594.tqL-GS.rst1
3 files changed, 4 insertions, 3 deletions
diff --git a/Lib/test/test_spwd.py b/Lib/test/test_spwd.py
index e893f3a..07793c8 100644
--- a/Lib/test/test_spwd.py
+++ b/Lib/test/test_spwd.py
@@ -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__":
diff --git a/Lib/test/test_tabnanny.py b/Lib/test/test_tabnanny.py
index ec88736..845096e 100644
--- a/Lib/test/test_tabnanny.py
+++ b/Lib/test/test_tabnanny.py
@@ -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):
diff --git a/Misc/NEWS.d/next/Tests/2018-09-05-23-50-21.bpo-34594.tqL-GS.rst b/Misc/NEWS.d/next/Tests/2018-09-05-23-50-21.bpo-34594.tqL-GS.rst
new file mode 100644
index 0000000..7a7b1f0
--- /dev/null
+++ b/Misc/NEWS.d/next/Tests/2018-09-05-23-50-21.bpo-34594.tqL-GS.rst
@@ -0,0 +1 @@
+Fix usage of hardcoded ``errno`` values in the tests.