bpo-31904: Disable os.popen and popen test cases on VxWorks (GH-21687)
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py
index dbb2975..08d7ab8 100644
--- a/Lib/test/test_os.py
+++ b/Lib/test/test_os.py
@@ -991,6 +991,7 @@ def _empty_mapping(self):
# Bug 1110478
@unittest.skipUnless(unix_shell and os.path.exists(unix_shell),
'requires a shell')
+ @unittest.skipUnless(hasattr(os, 'popen'), "needs os.popen()")
def test_update2(self):
os.environ.clear()
os.environ.update(HELLO="World")
@@ -1000,6 +1001,7 @@ def test_update2(self):
@unittest.skipUnless(unix_shell and os.path.exists(unix_shell),
'requires a shell')
+ @unittest.skipUnless(hasattr(os, 'popen'), "needs os.popen()")
def test_os_popen_iter(self):
with os.popen("%s -c 'echo \"line1\nline2\nline3\"'"
% unix_shell) as popen:
diff --git a/Lib/test/test_popen.py b/Lib/test/test_popen.py
index ab1bc77..cac2f61 100644
--- a/Lib/test/test_popen.py
+++ b/Lib/test/test_popen.py
@@ -7,6 +7,9 @@
from test import support
import os, sys
+if not hasattr(os, 'popen'):
+ raise unittest.SkipTest("need os.popen()")
+
# Test that command-lines get down as we expect.
# To do this we execute:
# python -c "import sys;print(sys.argv)" {rest_of_commandline}
diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py
index 185b293..cd18a49 100644
--- a/Lib/test/test_posix.py
+++ b/Lib/test/test_posix.py
@@ -1045,6 +1045,7 @@ def test_getgrouplist(self):
@unittest.skipUnless(hasattr(os, 'getegid'), "test needs os.getegid()")
+ @unittest.skipUnless(hasattr(os, 'popen'), "test needs os.popen()")
def test_getgroups(self):
with os.popen('id -G 2>/dev/null') as idg:
groups = idg.read().strip()
diff --git a/Lib/test/test_select.py b/Lib/test/test_select.py
index 4ddd5fb..f63564e 100644
--- a/Lib/test/test_select.py
+++ b/Lib/test/test_select.py
@@ -46,6 +46,7 @@ def test_returned_list_identity(self):
self.assertIsNot(r, x)
self.assertIsNot(w, x)
+ @unittest.skipUnless(hasattr(os, 'popen'), "need os.popen()")
def test_select(self):
code = textwrap.dedent('''
import time