bpo-31904: Fix test_tabnanny on VxWorks (GH-12646) · python/cpython@36c41bc

Original file line numberDiff line numberDiff line change

@@ -6,6 +6,8 @@

66

from unittest import TestCase, mock

77

from unittest import mock

88

import errno

9+

import os

10+

import sys

911

import tabnanny

1012

import tokenize

1113

import tempfile

@@ -233,8 +235,8 @@ def test_when_nannynag_error(self):

233235

def test_when_no_file(self):

234236

"""A python file which does not exist actually in system."""

235237

path = 'no_file.py'

236-

err = f"{path!r}: I/O Error: [Errno {errno.ENOENT}] " \

237-

f"No such file or directory: {path!r}\n"

238+

err = (f"{path!r}: I/O Error: [Errno {errno.ENOENT}] "

239+

f"{os.strerror(errno.ENOENT)}: {path!r}\n")

238240

self.verify_tabnanny_check(path, err=err)

239241
240242

def test_errored_directory(self):