def test_spawnve(self): ping_cmd = os.path.join(os.environ["windir"], "system32", "ping") #simple sanity checks nt.spawnve(nt.P_WAIT, ping_cmd, ["ping", "/?"], {}) nt.spawnve(nt.P_WAIT, ping_cmd, ["ping", "127.0.0.1"], {}) nt.spawnve(nt.P_WAIT, ping_cmd, ["ping", "-n", "2", "-w", "1000", "127.0.0.1"], {}) #negative cases self.assertRaises(TypeError, nt.spawnve, nt.P_WAIT, ping_cmd , ["ping", "/?"], None) self.assertRaises(TypeError, nt.spawnve, nt.P_WAIT, ping_cmd , ["ping", "/?"], {1: "xyz"}) self.assertRaises(TypeError, nt.spawnve, nt.P_WAIT, ping_cmd , ["ping", "/?"], {"abc": 1})
def test_spawnve(): ''' ''' ping_cmd = get_environ_variable("windir") + "\system32\ping" #simple sanity checks nt.spawnve(nt.P_WAIT, ping_cmd, ["ping", "/?"], {}) nt.spawnve(nt.P_WAIT, ping_cmd, ["ping", "127.0.0.1"], {}) nt.spawnve(nt.P_WAIT, ping_cmd, ["ping", "-n", "6", "-w", "1000", "127.0.0.1"], {}) #negative cases AssertError(TypeError, nt.spawnve, nt.P_WAIT, ping_cmd , ["ping", "/?"], None) AssertError(TypeError, nt.spawnve, nt.P_WAIT, ping_cmd , ["ping", "/?"], {1: "xyz"}) AssertError(TypeError, nt.spawnve, nt.P_WAIT, ping_cmd , ["ping", "/?"], {"abc": 1})