From e26498570e4d5622a4e152ebe4e958b44d2a489b Mon Sep 17 00:00:00 2001 From: Peixing Xin Date: Fri, 7 May 2021 15:56:18 +0800 Subject: [PATCH 1/2] correct error string in test.test_py_compile.PyCompileCLITestCase.test_file_not_exists for VxWorks --- Lib/test/test_py_compile.py | 6 +++++- .../next/Tests/2021-05-07-15-46-04.bpo-31904.8dk3la.rst | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 Misc/NEWS.d/next/Tests/2021-05-07-15-46-04.bpo-31904.8dk3la.rst diff --git a/Lib/test/test_py_compile.py b/Lib/test/test_py_compile.py index b58f28a4bc8885..909e1d54dcad09 100644 --- a/Lib/test/test_py_compile.py +++ b/Lib/test/test_py_compile.py @@ -276,7 +276,11 @@ def test_file_not_exists(self): rc, stdout, stderr = self.pycompilecmd_failure(self.source_path, should_not_exists) self.assertEqual(rc, 1) self.assertEqual(stdout, b'') - self.assertIn(b'No such file or directory', stderr) + if sys.platform == 'vxworks': + err_str = b'no such file or directory' + else: + err_str = b'No such file or directory' + self.assertIn(err_str, stderr) def test_file_not_exists_with_quiet(self): should_not_exists = os.path.join(os.path.dirname(__file__), 'should_not_exists.py') diff --git a/Misc/NEWS.d/next/Tests/2021-05-07-15-46-04.bpo-31904.8dk3la.rst b/Misc/NEWS.d/next/Tests/2021-05-07-15-46-04.bpo-31904.8dk3la.rst new file mode 100644 index 00000000000000..9b7710d2ffadbb --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2021-05-07-15-46-04.bpo-31904.8dk3la.rst @@ -0,0 +1 @@ +Correct error string in test_file_not_exists() for VxWorks. From ed356848d0085ceb3ad0ecc7ff9bdaf4fbc12328 Mon Sep 17 00:00:00 2001 From: Peixing Xin Date: Sat, 8 May 2021 15:18:11 +0800 Subject: [PATCH 2/2] ignore error string case in test_file_not_exists() --- Lib/test/test_py_compile.py | 6 +----- .../next/Tests/2021-05-07-15-46-04.bpo-31904.8dk3la.rst | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/Lib/test/test_py_compile.py b/Lib/test/test_py_compile.py index 909e1d54dcad09..5ed98dbff1737e 100644 --- a/Lib/test/test_py_compile.py +++ b/Lib/test/test_py_compile.py @@ -276,11 +276,7 @@ def test_file_not_exists(self): rc, stdout, stderr = self.pycompilecmd_failure(self.source_path, should_not_exists) self.assertEqual(rc, 1) self.assertEqual(stdout, b'') - if sys.platform == 'vxworks': - err_str = b'no such file or directory' - else: - err_str = b'No such file or directory' - self.assertIn(err_str, stderr) + self.assertIn(b'no such file or directory', stderr.lower()) def test_file_not_exists_with_quiet(self): should_not_exists = os.path.join(os.path.dirname(__file__), 'should_not_exists.py') diff --git a/Misc/NEWS.d/next/Tests/2021-05-07-15-46-04.bpo-31904.8dk3la.rst b/Misc/NEWS.d/next/Tests/2021-05-07-15-46-04.bpo-31904.8dk3la.rst index 9b7710d2ffadbb..334878f91ddacd 100644 --- a/Misc/NEWS.d/next/Tests/2021-05-07-15-46-04.bpo-31904.8dk3la.rst +++ b/Misc/NEWS.d/next/Tests/2021-05-07-15-46-04.bpo-31904.8dk3la.rst @@ -1 +1 @@ -Correct error string in test_file_not_exists() for VxWorks. +Ignore error string case in test_file_not_exists().