def test_run_cmd_2(self): fLOG( __file__, self._testMethodName, OutputPrint=__name__ == "__main__") cmd = "set" if sys.platform.startswith("win") else "env" out3, err = run_cmd( cmd, wait=True, communicate=False, tell_if_no_output=600, fLOG=fLOG) fLOG("***", out3) out, err = skip_run_cmd(cmd, wait=True) assert len(out) == 0 assert len(err) == 0 counts = dict(out=[], err=[]) def stop_running_if(out, err, counts=counts): if out: counts["out"].append(out) if err: counts["err"].append(err) out4, err = run_cmd( cmd, wait=True, communicate=False, tell_if_no_output=600, stop_running_if=stop_running_if, fLOG=fLOG) fLOG("***", out3) out, err = skip_run_cmd(cmd, wait=True) assert len(out) == 0 assert len(err) == 0 self.maxDiff = None self.assertEqual(out3.strip(), out4.strip()) assert len(counts["out"]) > 0 if len(counts["err"]) > 0: raise Exception(counts["err"])
def test_run_cmd_simple(self): fLOG(__file__, self._testMethodName, OutputPrint=__name__ == "__main__") cmd = "dir ." out1, err = run_cmd(cmd, wait=True, fLOG=fLOG) out2, err = run_cmd(cmd, wait=True, communicate=False, fLOG=fLOG) fLOG("***", out1) fLOG("***", out2) out3, err = run_cmd(cmd, wait=True, communicate=True, fLOG=fLOG) fLOG("***", out3) out, err = skip_run_cmd(cmd, wait=True) assert len(out) == 0 assert len(err) == 0