def test_status(self): fLOG( __file__, self._testMethodName, OutputPrint=__name__ == "__main__") if is_travis_or_appveyor() == "travis": warnings.warn("run_cmd no end on travis") return temp = get_temp_folder(__file__, "temp_status") outfile = os.path.join(temp, "modules.xlsx") this = os.path.abspath(os.path.dirname(__file__)) script = os.path.normpath(os.path.join( this, "..", "..", "src", "pymyinstall", "cli", "pymy_status.py")) cmd = "{0} -u {1} {2}".format( sys.executable, script, "numpy --out={0}".format(outfile)) fLOG(cmd) out, err = run_cmd(cmd, wait=True) if len(out) == 0: if is_travis_or_appveyor() == "appveyor": warnings.warn( "CLI ISSUE cmd:\n{0}\nOUT:\n{1}\nERR\n{2}".format(cmd, out, err)) return else: raise Exception( "cmd:\n{0}\nOUT:\n{1}\nERR\n{2}".format(cmd, out, err)) if len(err) > 0: raise Exception( "cmd:\n{0}\nOUT:\n{1}\nERR\n{2}".format(cmd, out, err)) if not os.path.exists(outfile): raise Exception(outfile) fLOG(out)
def test_status(self): fLOG(__file__, self._testMethodName, OutputPrint=__name__ == "__main__") if is_travis_or_appveyor() == "travis": warnings.warn("run_cmd no end on travis") return temp = get_temp_folder(__file__, "temp_status") outfile = os.path.join(temp, "modules.xlsx") this = os.path.abspath(os.path.dirname(__file__)) script = os.path.normpath( os.path.join(this, "..", "..", "src", "pymyinstall", "cli", "pymy_status.py")) cmd = "{0} -u {1} {2}".format(sys.executable, script, "numpy --out={0}".format(outfile)) fLOG(cmd) out, err = run_cmd(cmd, wait=True) if len(out) == 0: if is_travis_or_appveyor() == "appveyor": warnings.warn( "CLI ISSUE cmd:\n{0}\nOUT:\n{1}\nERR\n{2}".format( cmd, out, err)) return else: raise Exception("cmd:\n{0}\nOUT:\n{1}\nERR\n{2}".format( cmd, out, err)) if len(err) > 0: raise Exception("cmd:\n{0}\nOUT:\n{1}\nERR\n{2}".format( cmd, out, err)) if not os.path.exists(outfile): raise Exception(outfile) fLOG(out)
def test_install_set_schedule(self): fLOG(__file__, self._testMethodName, OutputPrint=__name__ == "__main__") this = os.path.abspath(os.path.dirname(__file__)) script = os.path.normpath( os.path.join(this, "..", "..", "src", "pymyinstall", "cli", "pymy_install.py")) cmd = "{0} -u {1} {2}".format(sys.executable, script, "--set=pyquickhelper --schedule") try: out, err = run_cmd(cmd, wait=True, fLOG=fLOG, communicate=True, timeout=60) except subprocess.CalledProcessError as e: mes = "CMD\n{0}\nOUT\n{1}\nERR\n{2}".format( e.cmd, e.output, e.stderr.read() if e.stderr else "") raise Exception(mes) from e if len(out) == 0: if is_travis_or_appveyor() == "appveyor": warnings.warn( "CLI ISSUE cmd:\n{0}\nOUT:\n{1}\nERR\n{2}".format( cmd, out, err)) else: raise Exception("cmd:\n{0}\nOUT:\n{1}\nERR\n{2}".format( cmd, out, err))
def test_install_tool(self): fLOG(__file__, self._testMethodName, OutputPrint=__name__ == "__main__") if is_travis_or_appveyor() == "travis": warnings.warn("run_cmd no end on travis") return temp = get_temp_folder(__file__, "temp_install_tool") this = os.path.abspath(os.path.dirname(__file__)) script = os.path.normpath( os.path.join(this, "..", "..", "src", "pymyinstall", "cli", "pymy_install.py")) cmd = "{0} -u {1} {2} --force --folder={3}".format( sys.executable, script, "graphviz --task=tool --source=zip", temp) out, err = run_cmd(cmd, wait=True) fLOG("----", cmd) fLOG(out.replace("\r", "").replace("\n\n", "\n")) fLOG("-----") fLOG(err.replace("\r", "").replace("\n\n", "\n")) content = os.listdir(temp) if not content: comp = "OUT:\n{0}\nERR:\n{1}".format(out, err) if is_travis_or_appveyor(): warnings.warn("content is empty for: " + temp + "\n" + comp) else: raise Exception("content is empty for: " + temp + "\n" + comp)
def test_install_deps(self): fLOG(__file__, self._testMethodName, OutputPrint=__name__ == "__main__") this = os.path.abspath(os.path.dirname(__file__)) script = os.path.normpath(os.path.join(this, "..", "..", "src", "pymyinstall", "cli", "pymy_deps.py")) cmd = "{0} -u {1} {2}".format(sys.executable, script, "pandas") try: out, err = run_cmd(cmd, wait=True, fLOG=fLOG, communicate=True, timeout=120) except subprocess.CalledProcessError as e: mes = "CMD\n{0}\nOUT\n{1}\nERR\n{2}".format(e.cmd, e.output, e.stderr.read() if e.stderr else "") raise Exception(mes) from e out = out.strip() if len(out) == 0: if is_travis_or_appveyor() == "appveyor": warnings.warn("CLI ISSUE cmd:\n{0}\nOUT:\n{1}\nERR\n{2}".format(cmd, out, err)) else: raise Exception("cmd:\n{0}\nOUT:\n{1}\nERR\n{2}".format(cmd, out, err)) else: fLOG(out) if sys.version_info[0] == 2: # failing on Python 2.7 return if "pandas" not in out: raise Exception(out) if "['pandas']" not in out: raise Exception(out)
def test_run_cmd(self): fLOG( __file__, self._testMethodName, OutputPrint=__name__ == "__main__") if sys.version_info[0] == 2: # disabled on python 2.7 return out, err = run_cmd("find", wait=True, fLOG=fLOG)
def test_install_set_schedule(self): fLOG(__file__, self._testMethodName, OutputPrint=__name__ == "__main__") this = os.path.abspath(os.path.dirname(__file__)) script = os.path.normpath(os.path.join(this, "..", "..", "src", "pymyinstall", "cli", "pymy_install.py")) cmd = "{0} -u {1} {2}".format(sys.executable, script, "--set=pyquickhelper --schedule") try: out, err = run_cmd(cmd, wait=True, fLOG=fLOG, communicate=True, timeout=60) except subprocess.CalledProcessError as e: mes = "CMD\n{0}\nOUT\n{1}\nERR\n{2}".format(e.cmd, e.output, e.stderr.read() if e.stderr else "") raise Exception(mes) from e if len(out) == 0: if is_travis_or_appveyor() == "appveyor": warnings.warn("CLI ISSUE cmd:\n{0}\nOUT:\n{1}\nERR\n{2}".format(cmd, out, err)) else: raise Exception("cmd:\n{0}\nOUT:\n{1}\nERR\n{2}".format(cmd, out, err))
def test_install_deps(self): fLOG(__file__, self._testMethodName, OutputPrint=__name__ == "__main__") this = os.path.abspath(os.path.dirname(__file__)) script = os.path.normpath( os.path.join(this, "..", "..", "src", "pymyinstall", "cli", "pymy_deps.py")) cmd = "{0} -u {1} {2}".format(sys.executable, script, "pandas") try: out, err = run_cmd(cmd, wait=True, fLOG=fLOG, communicate=True, timeout=120) except subprocess.CalledProcessError as e: mes = "CMD\n{0}\nOUT\n{1}\nERR\n{2}".format( e.cmd, e.output, e.stderr.read() if e.stderr else "") raise Exception(mes) from e out = out.strip() if len(out) == 0: if is_travis_or_appveyor() == "appveyor": warnings.warn( "CLI ISSUE cmd:\n{0}\nOUT:\n{1}\nERR\n{2}".format( cmd, out, err)) else: raise Exception("cmd:\n{0}\nOUT:\n{1}\nERR\n{2}".format( cmd, out, err)) else: fLOG(out) if sys.version_info[0] == 2: # failing on Python 2.7 return if "pandas" not in out: raise Exception("(1)CMD:\n{0}\nOUT\n{1}\nERR\n{2}".format( cmd, out, err)) if "['pandas']" not in out: raise Exception("(2)CMD:\n{0}\nOUT\n{1}\nERR\n{2}".format( cmd, out, err))
def test_update_set_schedule(self): fLOG( __file__, self._testMethodName, OutputPrint=__name__ == "__main__") if is_travis_or_appveyor() == "travis": warnings.warn("run_cmd no end on travis") return this = os.path.abspath(os.path.dirname(__file__)) script = os.path.normpath(os.path.join( this, "..", "..", "src", "pymyinstall", "cli", "pymy_update.py")) cmd = "{0} -u {1} {2}".format( sys.executable, script, "--set=pyquickhelper --schedule") out, err = run_cmd(cmd, wait=True) if len(out) == 0: if is_travis_or_appveyor() == "appveyor": warnings.warn( "CLI ISSUE cmd:\n{0}\nOUT:\n{1}\nERR\n{2}".format(cmd, out, err)) else: raise Exception( "cmd:\n{0}\nOUT:\n{1}\nERR\n{2}".format(cmd, out, err))
def test_update_set_schedule(self): fLOG(__file__, self._testMethodName, OutputPrint=__name__ == "__main__") if is_travis_or_appveyor() == "travis": warnings.warn("run_cmd no end on travis") return this = os.path.abspath(os.path.dirname(__file__)) script = os.path.normpath( os.path.join(this, "..", "..", "src", "pymyinstall", "cli", "pymy_update.py")) cmd = "{0} -u {1} {2}".format(sys.executable, script, "--set=pyquickhelper --schedule") out, err = run_cmd(cmd, wait=True) if len(out) == 0: if is_travis_or_appveyor() == "appveyor": warnings.warn( "CLI ISSUE cmd:\n{0}\nOUT:\n{1}\nERR\n{2}".format( cmd, out, err)) else: raise Exception("cmd:\n{0}\nOUT:\n{1}\nERR\n{2}".format( cmd, out, err))
def test_install_download(self): fLOG(__file__, self._testMethodName, OutputPrint=__name__ == "__main__") temp = get_temp_folder(__file__, "temp_install_download") this = os.path.abspath(os.path.dirname(__file__)) script = os.path.normpath(os.path.join(this, "..", "..", "src", "pymyinstall", "cli", "pymy_install.py")) cmd = "{0} {1} {2} --force --folder={3}".format(sys.executable, script, "colorama xlrd --download", temp) out, err = run_cmd(cmd, wait=True, fLOG=fLOG, communicate=True, timeout=60) fLOG("----", cmd) fLOG(out.replace("\r", "").replace("\n\n", "\n")) fLOG("-----") fLOG(err.replace("\r", "").replace("\n\n", "\n")) if len(out) == 0 and is_travis_or_appveyor() == "appveyor": warnings.warn("CLI ISSUE cmd:\n{0}\nOUT:\n{1}\nERR\n{2}".format(cmd, out, err)) return if "downloaded modules" not in out: raise Exception("CMD: {0}\nOUT:\n{1}\nERR\n{2}".format(cmd, out, err)) content = os.listdir(temp) if len(content) != 2: if is_travis_or_appveyor() == "appveyor": warnings.warn("CLI ISSUE cmd:\n{0}\nOUT:\n{1}\nERR\n{2}".format(cmd, out, err)) else: raise Exception("cmd:\n{0}\nOUT:\n{1}\nERR\n{2}".format(cmd, out, err))
def test_install_download(self): fLOG(__file__, self._testMethodName, OutputPrint=__name__ == "__main__") temp = get_temp_folder(__file__, "temp_install_download") this = os.path.abspath(os.path.dirname(__file__)) script = os.path.normpath( os.path.join(this, "..", "..", "src", "pymyinstall", "cli", "pymy_install.py")) cmd = "{0} {1} {2} --force --folder={3}".format( sys.executable, script, "colorama xlrd --download", temp) out, err = run_cmd(cmd, wait=True, fLOG=fLOG, communicate=True, timeout=60) fLOG("----", cmd) fLOG(out.replace("\r", "").replace("\n\n", "\n")) fLOG("-----") fLOG(err.replace("\r", "").replace("\n\n", "\n")) if len(out) == 0 and is_travis_or_appveyor() == "appveyor": warnings.warn("CLI ISSUE cmd:\n{0}\nOUT:\n{1}\nERR\n{2}".format( cmd, out, err)) return if "downloaded modules" not in out: raise Exception("CMD: {0}\nOUT:\n{1}\nERR\n{2}".format( cmd, out, err)) content = os.listdir(temp) if len(content) != 2: if is_travis_or_appveyor() == "appveyor": warnings.warn( "CLI ISSUE cmd:\n{0}\nOUT:\n{1}\nERR\n{2}".format( cmd, out, err)) else: raise Exception("cmd:\n{0}\nOUT:\n{1}\nERR\n{2}".format( cmd, out, err))
def test_install_tool(self): fLOG(__file__, self._testMethodName, OutputPrint=__name__ == "__main__") if is_travis_or_appveyor() == "travis": warnings.warn("run_cmd no end on travis") return temp = get_temp_folder(__file__, "temp_install_tool") this = os.path.abspath(os.path.dirname(__file__)) script = os.path.normpath(os.path.join(this, "..", "..", "src", "pymyinstall", "cli", "pymy_install.py")) cmd = "{0} -u {1} {2} --force --folder={3}".format( sys.executable, script, "graphviz --task=tool --source=zip", temp ) out, err = run_cmd(cmd, wait=True) fLOG("----", cmd) fLOG(out.replace("\r", "").replace("\n\n", "\n")) fLOG("-----") fLOG(err.replace("\r", "").replace("\n\n", "\n")) content = os.listdir(temp) if not content: comp = "OUT:\n{0}\nERR:\n{1}".format(out, err) if is_travis_or_appveyor(): warnings.warn("content is empty for: " + temp + "\n" + comp) else: raise Exception("content is empty for: " + temp + "\n" + comp)