import os import sys import unittest from test import support class SpawnTests(unittest.TestCase): def test_spawn(self): filename = support.TESTFN self.addCleanup(support.unlink, filename) with open(filename, "w") as fp: fp.write('import sys; sys.exit(17)') args = [sys.executable, filename] self.assertRaises(ValueError, os.spawnl, os.P_NOWAIT, args[0], '') self.assertRaises(ValueError, os.spawnle, os.P_NOWAIT, args[0], '', {}) if __name__ == "__main__": unittest.main()