From e64be8ccde9e140cfdfff5a976e5872b965e5afc Mon Sep 17 00:00:00 2001 From: lzhao Date: Mon, 1 Apr 2019 17:43:52 +0800 Subject: [PATCH 1/6] bpo-31904: skip some test case in test_cmd_line for VxWorks doesn't support preexec subprocess.Popen doesn't support preexec, test_cmd_line need to skip the case which use preexec --- Lib/test/test_cmd_line.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Lib/test/test_cmd_line.py b/Lib/test/test_cmd_line.py index 21511b896cad17..12ad68cd396e8e 100644 --- a/Lib/test/test_cmd_line.py +++ b/Lib/test/test_cmd_line.py @@ -18,6 +18,11 @@ # Debug build? Py_DEBUG = hasattr(sys, "gettotalrefcount") +def _supports_preexec(): + if sys.platform == "vxworks": + return False + else: + return True # XXX (ncoghlan): Move to script_helper and make consistent with run_python def _kill_python_and_exit_code(p): @@ -369,6 +374,7 @@ def test_closed_stdout(self): # Issue #7111: Python should work without standard streams @unittest.skipIf(os.name != 'posix', "test needs POSIX semantics") + @unittest.skipUnless(_supports_preexec(), "test needs preexec support in subprocess.Popen") def _test_no_stdio(self, streams): code = """if 1: import os, sys From 3762b12e3e866767454d1a0ad3d3e53c8fb2d666 Mon Sep 17 00:00:00 2001 From: lzhao Date: Mon, 1 Apr 2019 17:45:57 +0800 Subject: [PATCH 2/6] add news file --- .../NEWS.d/next/Library/2019-04-01-17-44-36.bpo-31904.32Ef3G.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Library/2019-04-01-17-44-36.bpo-31904.32Ef3G.rst diff --git a/Misc/NEWS.d/next/Library/2019-04-01-17-44-36.bpo-31904.32Ef3G.rst b/Misc/NEWS.d/next/Library/2019-04-01-17-44-36.bpo-31904.32Ef3G.rst new file mode 100644 index 00000000000000..1a239d021d5106 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-04-01-17-44-36.bpo-31904.32Ef3G.rst @@ -0,0 +1 @@ +Skip test case in test_cmd_line for VxWorks doesn't support preexec when do Popen From 48839c2b7b287c7974581c6b31a0557b5a6dee6a Mon Sep 17 00:00:00 2001 From: lzhao Date: Wed, 17 Apr 2019 11:22:28 +0800 Subject: [PATCH 3/6] Move NEWS.d file to test directory --- .../{Library => Tests}/2019-04-01-17-44-36.bpo-31904.32Ef3G.rst | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Misc/NEWS.d/next/{Library => Tests}/2019-04-01-17-44-36.bpo-31904.32Ef3G.rst (100%) diff --git a/Misc/NEWS.d/next/Library/2019-04-01-17-44-36.bpo-31904.32Ef3G.rst b/Misc/NEWS.d/next/Tests/2019-04-01-17-44-36.bpo-31904.32Ef3G.rst similarity index 100% rename from Misc/NEWS.d/next/Library/2019-04-01-17-44-36.bpo-31904.32Ef3G.rst rename to Misc/NEWS.d/next/Tests/2019-04-01-17-44-36.bpo-31904.32Ef3G.rst From 700aca1539a0cca8c5bdaae7507ae3f9309861a7 Mon Sep 17 00:00:00 2001 From: lzhao Date: Wed, 17 Apr 2019 22:02:38 +0800 Subject: [PATCH 4/6] rework test_cmd_line based on reviewer's comment to use variable instead of function --- Lib/test/test_cmd_line.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Lib/test/test_cmd_line.py b/Lib/test/test_cmd_line.py index 12ad68cd396e8e..2a55bbaece4c05 100644 --- a/Lib/test/test_cmd_line.py +++ b/Lib/test/test_cmd_line.py @@ -18,11 +18,8 @@ # Debug build? Py_DEBUG = hasattr(sys, "gettotalrefcount") -def _supports_preexec(): - if sys.platform == "vxworks": - return False - else: - return True +# Support preexec? +SUBPROCESS_SUPPORTS_PREEXEC = (sys.platform != "vxworks") # XXX (ncoghlan): Move to script_helper and make consistent with run_python def _kill_python_and_exit_code(p): @@ -374,7 +371,8 @@ def test_closed_stdout(self): # Issue #7111: Python should work without standard streams @unittest.skipIf(os.name != 'posix', "test needs POSIX semantics") - @unittest.skipUnless(_supports_preexec(), "test needs preexec support in subprocess.Popen") + @unittest.skipUnless(SUBPROCESS_SUPPORTS_PREEXEC, + "test needs preexec support in subprocess.Popen") def _test_no_stdio(self, streams): code = """if 1: import os, sys From d3c2377e021078376448a965f86c33551b477338 Mon Sep 17 00:00:00 2001 From: lzhao Date: Wed, 17 Apr 2019 22:26:57 +0800 Subject: [PATCH 5/6] update test_cmd_line.py to check vxworks platform directly --- Lib/test/test_cmd_line.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Lib/test/test_cmd_line.py b/Lib/test/test_cmd_line.py index 2a55bbaece4c05..294219b5275e85 100644 --- a/Lib/test/test_cmd_line.py +++ b/Lib/test/test_cmd_line.py @@ -18,9 +18,6 @@ # Debug build? Py_DEBUG = hasattr(sys, "gettotalrefcount") -# Support preexec? -SUBPROCESS_SUPPORTS_PREEXEC = (sys.platform != "vxworks") - # XXX (ncoghlan): Move to script_helper and make consistent with run_python def _kill_python_and_exit_code(p): data = kill_python(p) @@ -371,7 +368,7 @@ def test_closed_stdout(self): # Issue #7111: Python should work without standard streams @unittest.skipIf(os.name != 'posix', "test needs POSIX semantics") - @unittest.skipUnless(SUBPROCESS_SUPPORTS_PREEXEC, + @unittest.skipIf(sys.platform == "vxworks", "test needs preexec support in subprocess.Popen") def _test_no_stdio(self, streams): code = """if 1: From 9195390c5648ea0ccc976d3f489976bc46c783f9 Mon Sep 17 00:00:00 2001 From: lzhao Date: Wed, 17 Apr 2019 23:07:52 +0800 Subject: [PATCH 6/6] recover blank line and delete NEWS --- Lib/test/test_cmd_line.py | 1 + Misc/NEWS.d/next/Tests/2019-04-01-17-44-36.bpo-31904.32Ef3G.rst | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) delete mode 100644 Misc/NEWS.d/next/Tests/2019-04-01-17-44-36.bpo-31904.32Ef3G.rst diff --git a/Lib/test/test_cmd_line.py b/Lib/test/test_cmd_line.py index 294219b5275e85..f7925eb795c71e 100644 --- a/Lib/test/test_cmd_line.py +++ b/Lib/test/test_cmd_line.py @@ -18,6 +18,7 @@ # Debug build? Py_DEBUG = hasattr(sys, "gettotalrefcount") + # XXX (ncoghlan): Move to script_helper and make consistent with run_python def _kill_python_and_exit_code(p): data = kill_python(p) diff --git a/Misc/NEWS.d/next/Tests/2019-04-01-17-44-36.bpo-31904.32Ef3G.rst b/Misc/NEWS.d/next/Tests/2019-04-01-17-44-36.bpo-31904.32Ef3G.rst deleted file mode 100644 index 1a239d021d5106..00000000000000 --- a/Misc/NEWS.d/next/Tests/2019-04-01-17-44-36.bpo-31904.32Ef3G.rst +++ /dev/null @@ -1 +0,0 @@ -Skip test case in test_cmd_line for VxWorks doesn't support preexec when do Popen