[Python-checkins] cpython: #1087: use proper skips in test_os.
ezio.melotti
python-checkins at python.org
Wed Sep 26 19:02:03 CEST 2012
http://hg.python.org/cpython/rev/c8cc94a0ba4c
changeset: 79195:c8cc94a0ba4c
user: Ezio Melotti <ezio.melotti at gmail.com>
date: Wed Sep 26 20:01:34 2012 +0300
summary:
#1087: use proper skips in test_os.
files:
Lib/test/test_os.py | 26 +++++++++++++-------------
1 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py
--- a/Lib/test/test_os.py
+++ b/Lib/test/test_os.py
@@ -514,23 +514,23 @@
return os.environ
# Bug 1110478
+ @unittest.skipUnless(os.path.exists('/bin/sh'), 'requires /bin/sh')
def test_update2(self):
os.environ.clear()
- if os.path.exists("/bin/sh"):
- os.environ.update(HELLO="World")
- with os.popen("/bin/sh -c 'echo $HELLO'") as popen:
- value = popen.read().strip()
- self.assertEqual(value, "World")
+ os.environ.update(HELLO="World")
+ with os.popen("/bin/sh -c 'echo $HELLO'") as popen:
+ value = popen.read().strip()
+ self.assertEqual(value, "World")
+ @unittest.skipUnless(os.path.exists('/bin/sh'), 'requires /bin/sh')
def test_os_popen_iter(self):
- if os.path.exists("/bin/sh"):
- with os.popen(
- "/bin/sh -c 'echo \"line1\nline2\nline3\"'") as popen:
- it = iter(popen)
- self.assertEqual(next(it), "line1\n")
- self.assertEqual(next(it), "line2\n")
- self.assertEqual(next(it), "line3\n")
- self.assertRaises(StopIteration, next, it)
+ with os.popen(
+ "/bin/sh -c 'echo \"line1\nline2\nline3\"'") as popen:
+ it = iter(popen)
+ self.assertEqual(next(it), "line1\n")
+ self.assertEqual(next(it), "line2\n")
+ self.assertEqual(next(it), "line3\n")
+ self.assertRaises(StopIteration, next, it)
# Verify environ keys and values from the OS are of the
# correct str type.
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list