[Python-checkins] bpo-31904: Fix test_tabnanny on VxWorks (GH-12646)

Victor Stinner webhook-mailer at python.org
Wed Apr 17 05:46:55 EDT 2019


https://github.com/python/cpython/commit/36c41bc2017921321dbb19557f616a6bb7572c83
commit: 36c41bc2017921321dbb19557f616a6bb7572c83
branch: master
author: Lihua Zhao <44661095+LihuaZhao at users.noreply.github.com>
committer: Victor Stinner <vstinner at redhat.com>
date: 2019-04-17T11:46:50+02:00
summary:

bpo-31904: Fix test_tabnanny on VxWorks (GH-12646)

 Fix test_tabnanny on VxWorks: adjust ENOENT error message,
use os.strerror().

files:
A Misc/NEWS.d/next/Tests/2019-04-01-16-06-36.bpo-31904.peaceF.rst
M Lib/test/test_tabnanny.py

diff --git a/Lib/test/test_tabnanny.py b/Lib/test/test_tabnanny.py
index 845096e63c26..81549d14ae2b 100644
--- a/Lib/test/test_tabnanny.py
+++ b/Lib/test/test_tabnanny.py
@@ -6,6 +6,8 @@
 from unittest import TestCase, mock
 from unittest import mock
 import errno
+import os
+import sys
 import tabnanny
 import tokenize
 import tempfile
@@ -233,8 +235,8 @@ def test_when_nannynag_error(self):
     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 {errno.ENOENT}] " \
-              f"No such file or directory: {path!r}\n"
+        err = (f"{path!r}: I/O Error: [Errno {errno.ENOENT}] "
+              f"{os.strerror(errno.ENOENT)}: {path!r}\n")
         self.verify_tabnanny_check(path, err=err)
 
     def test_errored_directory(self):
diff --git a/Misc/NEWS.d/next/Tests/2019-04-01-16-06-36.bpo-31904.peaceF.rst b/Misc/NEWS.d/next/Tests/2019-04-01-16-06-36.bpo-31904.peaceF.rst
new file mode 100644
index 000000000000..6297717e0fc6
--- /dev/null
+++ b/Misc/NEWS.d/next/Tests/2019-04-01-16-06-36.bpo-31904.peaceF.rst
@@ -0,0 +1 @@
+Fix test_tabnanny on VxWorks: adjust ENOENT error message.



More information about the Python-checkins mailing list