summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_os.py
diff options
context:
space:
mode:
authorSteve Dower <steve.dower@microsoft.com>2016-11-20 03:17:26 (GMT)
committerSteve Dower <steve.dower@microsoft.com>2016-11-20 03:17:26 (GMT)
commitbce26262d1b4873e2f9a3da69f638ba56d36ce89 (patch)
treeee540766a873f9ba74f452c4c0c675299c7d36a0 /Lib/test/test_os.py
parent859fd7bd7af90ce9a7f3a3184f2fce83013e0a96 (diff)
parent93ff8725b3f678586fbbc19d3d4b615b218300ff (diff)
downloadcpython-bce26262d1b4873e2f9a3da69f638ba56d36ce89.zip
cpython-bce26262d1b4873e2f9a3da69f638ba56d36ce89.tar.gz
cpython-bce26262d1b4873e2f9a3da69f638ba56d36ce89.tar.bz2
Issue #28732: Raise ValueError when argv[0] is empty
Diffstat (limited to 'Lib/test/test_os.py')
-rw-r--r--Lib/test/test_os.py18
1 files changed, 16 insertions, 2 deletions
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py
index 9194a8a..e9fdb07 100644
--- a/Lib/test/test_os.py
+++ b/Lib/test/test_os.py
@@ -1481,8 +1481,16 @@ class ExecTests(unittest.TestCase):
self.assertRaises(OSError, os.execvpe, 'no such app-',
['no such app-'], None)
+ def test_execv_with_bad_arglist(self):
+ self.assertRaises(ValueError, os.execv, 'notepad', ())
+ self.assertRaises(ValueError, os.execv, 'notepad', [])
+ self.assertRaises(ValueError, os.execv, 'notepad', ('',))
+ self.assertRaises(ValueError, os.execv, 'notepad', [''])
+
def test_execvpe_with_bad_arglist(self):
self.assertRaises(ValueError, os.execvpe, 'notepad', [], None)
+ self.assertRaises(ValueError, os.execvpe, 'notepad', [], {})
+ self.assertRaises(ValueError, os.execvpe, 'notepad', [''], {})
@unittest.skipUnless(hasattr(os, '_execvpe'),
"No internal os._execvpe function to test.")
@@ -2325,23 +2333,29 @@ class SpawnTests(unittest.TestCase):
def test_spawnl_noargs(self):
args = self.create_args()
self.assertRaises(ValueError, os.spawnl, os.P_NOWAIT, args[0])
+ self.assertRaises(ValueError, os.spawnl, os.P_NOWAIT, args[0], '')
@requires_os_func('spawnle')
- def test_spawnl_noargs(self):
+ def test_spawnle_noargs(self):
args = self.create_args()
self.assertRaises(ValueError, os.spawnle, os.P_NOWAIT, args[0], {})
+ self.assertRaises(ValueError, os.spawnle, os.P_NOWAIT, args[0], '', {})
@requires_os_func('spawnv')
def test_spawnv_noargs(self):
args = self.create_args()
self.assertRaises(ValueError, os.spawnv, os.P_NOWAIT, args[0], ())
self.assertRaises(ValueError, os.spawnv, os.P_NOWAIT, args[0], [])
+ self.assertRaises(ValueError, os.spawnv, os.P_NOWAIT, args[0], ('',))
+ self.assertRaises(ValueError, os.spawnv, os.P_NOWAIT, args[0], [''])
@requires_os_func('spawnve')
- def test_spawnv_noargs(self):
+ def test_spawnve_noargs(self):
args = self.create_args()
self.assertRaises(ValueError, os.spawnve, os.P_NOWAIT, args[0], (), {})
self.assertRaises(ValueError, os.spawnve, os.P_NOWAIT, args[0], [], {})
+ self.assertRaises(ValueError, os.spawnve, os.P_NOWAIT, args[0], ('',), {})
+ self.assertRaises(ValueError, os.spawnve, os.P_NOWAIT, args[0], [''], {})
# The introduction of this TestCase caused at least two different errors on
# *nix buildbots. Temporarily skip this to let the buildbots move along.