From de441ae34dd46106d5b75b3699e5059240b4ffcb Mon Sep 17 00:00:00 2001 From: pxin Date: Tue, 24 Nov 2020 17:21:02 +0800 Subject: [PATCH 1/2] add shell requirement for test_pipes --- Doc/library/pipes.rst | 2 ++ Lib/test/support/__init__.py | 2 +- Lib/test/test_pipes.py | 5 ++++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Doc/library/pipes.rst b/Doc/library/pipes.rst index 0a22da1f555bc2..57e27a6acf4b66 100644 --- a/Doc/library/pipes.rst +++ b/Doc/library/pipes.rst @@ -17,6 +17,8 @@ The :mod:`pipes` module defines a class to abstract the concept of a *pipeline* Because the module uses :program:`/bin/sh` command lines, a POSIX or compatible shell for :func:`os.system` and :func:`os.popen` is required. +.. availability:: Unix. Not available on VxWorks. + The :mod:`pipes` module defines the following class: diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py index 4ba749454c1873..5a45d78be91663 100644 --- a/Lib/test/support/__init__.py +++ b/Lib/test/support/__init__.py @@ -421,7 +421,7 @@ def requires_lzma(reason='requires lzma'): is_android = hasattr(sys, 'getandroidapilevel') -if sys.platform != 'win32': +if sys.platform not in ('win32', 'vxworks'): unix_shell = '/system/bin/sh' if is_android else '/bin/sh' else: unix_shell = None diff --git a/Lib/test/test_pipes.py b/Lib/test/test_pipes.py index 7d8cd54ba0e5b3..6a13b36d1cb70e 100644 --- a/Lib/test/test_pipes.py +++ b/Lib/test/test_pipes.py @@ -3,13 +3,16 @@ import string import unittest import shutil -from test.support import run_unittest, reap_children +from test.support import run_unittest, reap_children, unix_shell from test.support.os_helper import TESTFN, unlink if os.name != 'posix': raise unittest.SkipTest('pipes module only works on posix') +if not (unix_shell and os.path.exists(unix_shell)): + raise unittest.SkipTest('pipes module requires a shell') + TESTFN2 = TESTFN + "2" # tr a-z A-Z is not portable, so make the ranges explicit From 3cf4d39b722553f16f7bb21c3048e5541b53ce0a Mon Sep 17 00:00:00 2001 From: pxin Date: Tue, 24 Nov 2020 17:27:50 +0800 Subject: [PATCH 2/2] add news --- Misc/NEWS.d/next/Tests/2020-11-24-17-26-41.bpo-31904.eug834.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Tests/2020-11-24-17-26-41.bpo-31904.eug834.rst diff --git a/Misc/NEWS.d/next/Tests/2020-11-24-17-26-41.bpo-31904.eug834.rst b/Misc/NEWS.d/next/Tests/2020-11-24-17-26-41.bpo-31904.eug834.rst new file mode 100644 index 00000000000000..3e3942857b8f16 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2020-11-24-17-26-41.bpo-31904.eug834.rst @@ -0,0 +1 @@ +add shell requirement for test_pipes