本文整理汇总了Python中pyquickhelper.pycode.is_travis_or_appveyor函数的典型用法代码示例。如果您正苦于以下问题:Python is_travis_or_appveyor函数的具体用法?Python is_travis_or_appveyor怎么用?Python is_travis_or_appveyor使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_travis_or_appveyor函数的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_status
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)
开发者ID:sdpython,项目名称:pymyinstall,代码行数:32,代码来源:test_pymy_status_cli.py
示例2: test_kruskal_pygame_simulation
def test_kruskal_pygame_simulation(self):
fLOG(
__file__,
self._testMethodName,
OutputPrint=__name__ == "__main__")
temp = get_temp_folder(__file__, "temp_kruskal_pygame_simulation")
if is_travis_or_appveyor() in ("travis",):
# pygame.error: No available video device
return
import pygame
if is_travis_or_appveyor() == "circleci":
# os.environ["SDL_VIDEODRIVER"] = "x11"
flags = pygame.NOFRAME
else:
flags = 0
pygame.init()
pygame_simulation(fLOG=fLOG, max_iter=10 if __name__ != "__main__" else 10000,
pygame=pygame, folder=temp, flags=flags)
files = os.listdir(temp)
self.assertGreater(len(files), 9)
png = [os.path.join(temp, _)
for _ in files if os.path.splitext(_)[-1] == ".png"]
self.assertGreater(len(png), 0)
out = os.path.join(temp, "tsp_kruskal.avi")
v = make_video(png, out, size=(800, 500), format="XVID", fps=20)
self.assertNotEmpty(v)
开发者ID:sdpython,项目名称:ensae_teaching_cs,代码行数:31,代码来源:test_tsp_kruskal.py
示例3: test_image_video_epidemic
def test_image_video_epidemic(self):
fLOG(
__file__,
self._testMethodName,
OutputPrint=__name__ == "__main__")
temp = get_temp_folder(__file__, "temp_image_video_epidemic")
if is_travis_or_appveyor() in ("travis",):
# pygame.error: No available video device
return
import pygame
if is_travis_or_appveyor() == "circleci":
# os.environ["SDL_VIDEODRIVER"] = "x11"
flags = pygame.NOFRAME
else:
flags = 0
pygame_simulation(pygame, fLOG=fLOG, iter=10, folder=temp, flags=flags)
files = os.listdir(temp)
self.assertTrue(len(files) > 9)
png = [os.path.join(temp, _)
for _ in files if os.path.splitext(_)[-1] == ".png"]
self.assertTrue(len(png) > 0)
out = os.path.join(temp, "epidemic.avi")
v = make_video(png, out, size=(300, 300), format="XVID")
self.assertTrue(v is not None)
开发者ID:sdpython,项目名称:ensae_teaching_cs,代码行数:27,代码来源:test_propagation_epidemic.py
示例4: test_script_help
def test_script_help(self):
fLOG(
__file__,
self._testMethodName,
OutputPrint=__name__ == "__main__")
if is_travis_or_appveyor() == "travis":
warnings.warn("run_cmd no end on travis")
return
script = os.path.join(os.path.dirname(os.path.abspath(
__file__)), "..", "..", "src", "pymyinstall", "cli", "pymy_install.py")
if not os.path.exists(script):
raise Exception(script)
scriptu = os.path.join(os.path.dirname(os.path.abspath(
__file__)), "..", "..", "src", "pymyinstall", "cli", "pymy_update.py")
if not os.path.exists(script):
raise Exception(script)
exe = sys.executable
cmd = exe + " " + script + " --help"
out, err = run_cmd(cmd, wait=True, fLOG=fLOG)
if "usage: pymy_install.py" not in out:
raise Exception(out)
cmd = exe + " " + scriptu + " --help"
out, err = run_cmd(cmd, wait=True, fLOG=fLOG)
if "usage: pymy_update.py" not in out:
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))
开发者ID:sdpython,项目名称:pymyinstall,代码行数:34,代码来源:test_script_install_cli.py
示例5: test_image_video_puzzle_girafe
def test_image_video_puzzle_girafe(self):
fLOG(
__file__,
self._testMethodName,
OutputPrint=__name__ == "__main__")
temp = get_temp_folder(__file__, "temp_image_video_girafe")
if is_travis_or_appveyor() in ("travis",):
# pygame.error: No available video device
return
import pygame
if is_travis_or_appveyor() == "circleci":
# os.environ["SDL_VIDEODRIVER"] = "x11"
flags = pygame.NOFRAME
else:
flags = 0
pygame_simulation(pygame, fLOG=fLOG, folder=temp,
delay=200 if __name__ == "__main__" else 2,
flags=flags)
files = os.listdir(temp)
assert len(files) > 9
png = [os.path.join(temp, _)
for _ in files if os.path.splitext(_)[-1] == ".png"]
assert len(png) > 0
out = os.path.join(temp, "puzzle_girafe.avi")
v = make_video(png, out, size=(500, 500), format="XVID", fps=4)
assert v is not None
开发者ID:sdpython,项目名称:ensae_teaching_cs,代码行数:28,代码来源:test_puzzle_girafe.py
示例6: test_diff_full
def test_diff_full(self):
fLOG(
__file__,
self._testMethodName,
OutputPrint=__name__ == "__main__")
seq1 = "zab zab2 zabc3 zabcd zabc4".split()
seq2 = "ab ab2 abc3 abc4 abc adb".split()
diff = SequenceMatcher(a=seq1, b=seq2)
h = 20
size = 500, 500
white = 255, 255, 255
if is_travis_or_appveyor() in ("travis",):
# pygame.error: No available video device
return
import pygame
if is_travis_or_appveyor() == "circleci":
# os.environ["SDL_VIDEODRIVER"] = "x11"
flags = pygame.NOFRAME
else:
flags = 0
pygame, screen, fonts = get_pygame_screen_font(h, size, flags=flags)
from ensae_teaching_cs.helpers.pygame_helper import wait_event
bars = [random.randint(10, 500) / 500.0 for s in seq2]
screen.fill(white)
build_diff_image(pygame, screen, h=h, maxw=size[1], seq1=seq1, seq2=seq2, diff=diff,
fonts=fonts, bars=bars)
pygame.display.flip()
temp = get_temp_folder(__file__, "temp_video_diff_full")
for i in range(0, 21):
screen.fill(white)
build_diff_image(pygame, screen, h=h, maxw=size[0], seq1=seq1, seq2=seq2, diff=diff,
fonts=fonts, bars=bars, progress=i / 20.0, prev_bars=None)
pygame.time.wait(60)
pygame.display.flip()
pygame.image.save(screen, os.path.join(temp, "diff%d.png" % i))
if __name__ == "__main__":
from ensae_teaching_cs.helpers.video_helper import make_video
png = [os.path.join(temp, _)
for _ in os.listdir(temp) if ".png" in _]
out = os.path.join(temp, "diff.avi")
make_video(png, out, size=(350, 250), format="XVID", fps=5)
wait_event(pygame)
for font in fonts.values():
del font
pygame.quit()
开发者ID:sdpython,项目名称:ensae_teaching_cs,代码行数:56,代码来源:test_pygame_diff.py
示例7: valid
def valid(cell):
if "open_html_form" in cell:
return False
if "open_window_params" in cell:
return False
if '<div style="position:absolute' in cell:
return False
if "completion.dot" in cell and is_travis_or_appveyor() == "travis":
return False
if 'Image("completion.png")' in cell and is_travis_or_appveyor() == "travis":
return False
return True
开发者ID:sdpython,项目名称:mlstatpy,代码行数:12,代码来源:test_run_notebooks_nlp.py
示例8: test_download_zip
def test_download_zip(self):
fLOG(
__file__,
self._testMethodName,
OutputPrint=__name__ == "__main__")
fold = get_temp_folder(__file__, "temp_download")
url = "https://docs.python.org/3/library/ftplib.html"
f = download(url, fold)
fLOG(f)
self.assertTrue(os.path.exists(f))
if not f.endswith("ftplib.html"):
raise Exception(f)
out1 = os.path.join(fold, "try.html.gz")
gzip_files(out1, [f], fLOG=fLOG)
self.assertTrue(os.path.exists(out1))
out2 = os.path.join(fold, "try.zip")
zip_files(out2, [f], fLOG=fLOG)
self.assertTrue(os.path.exists(out2))
if is_travis_or_appveyor() in ("circleci", None):
out7 = os.path.join(fold, "try.7z")
zip7_files(out7, [out1, out2], fLOG=fLOG, temp_folder=fold)
if not os.path.exists(out7):
raise FileNotFoundError(out7)
else:
fLOG("skip 7z")
开发者ID:sdpython,项目名称:pyquickhelper,代码行数:28,代码来源:test_download.py
示例9: test_sphinx_ext_video_latex
def test_sphinx_ext_video_latex(self):
fLOG(
__file__,
self._testMethodName,
OutputPrint=__name__ == "__main__")
temp = get_temp_folder(__file__, "temp_sphinx_ext_video_latex")
fLOG('custom app init')
src_ = self.setup_format(temp)
app = CustomSphinxApp(src_, temp, buildername="latex")
fLOG('custom app build')
app.build()
fLOG('custom app done')
index = os.path.join(temp, "pyq-video.tex")
self.assertExists(index)
with open(index, "r", encoding="utf-8") as f:
content = f.read()
self.assertNotIn("unable to find", content)
self.assertIn('mur.mp4}', content)
index = os.path.join(temp, "mur.mp4")
self.assertExists(index)
index = os.path.join(temp, "jol", "mur2.mp4")
self.assertExists(index)
index = os.path.join(temp, "jol", 'im', "mur3.mp4")
self.assertExists(index)
if is_travis_or_appveyor() not in ('travis', 'appveyor'):
latex = find_latex_path()
fLOG("latex-compile", latex)
compile_latex_output_final(temp, latex, doall=True)
fLOG("compilatione done")
index = os.path.join(temp, "pyq-video.pdf")
self.assertExists(index)
开发者ID:sdpython,项目名称:pyquickhelper,代码行数:35,代码来源:test_video_extension.py
示例10: test_notebook_raw
def test_notebook_raw(self):
fLOG(
__file__,
self._testMethodName,
OutputPrint=__name__ == "__main__")
path = os.path.abspath(os.path.split(__file__)[0])
fold = os.path.normpath(os.path.join(path, "data"))
nbs = [os.path.join(fold, _)
for _ in os.listdir(fold) if "TD_2A" in _]
self.assertGreater(len(nbs), 0)
formats = ["latex", "present", "ipynb", "html",
"python", "rst", "pdf"]
if sys.platform.startswith("win"):
formats.append("docx")
temp = get_temp_folder(__file__, "temp_nb_bug_raw")
if is_travis_or_appveyor() in ('travis', 'appveyor'):
return
res = process_notebooks(nbs, temp, temp, formats=formats)
fLOG("*****", len(res))
for _ in res:
fLOG(_)
self.assertExists(_[0])
check = os.path.join(temp, "TD_2A_Eco_Web_Scraping.tex")
with open(check, "r", encoding="utf8") as f:
content = f.read()
if "\\begin{verbatim" not in content:
raise Exception(content)
开发者ID:sdpython,项目名称:pyquickhelper,代码行数:31,代码来源:test_notebooks_bug_raw.py
示例11: test_convert_slides_api_rst
def test_convert_slides_api_rst(self):
fLOG(
__file__,
self._testMethodName,
OutputPrint=__name__ == "__main__")
if is_travis_or_appveyor() in ('travis', 'appveyor'):
# no latex, no pandoc
return
path = os.path.abspath(os.path.split(__file__)[0])
fold = os.path.normpath(
os.path.join(
path,
"..",
"..",
"_doc",
"notebooks"))
nb = os.path.join(fold, "example_pyquickhelper.ipynb")
self.assertExists(nb)
nbr = read_nb(nb, kernel=False)
temp = get_temp_folder(__file__, "temp_nb_api_rst")
outfile = os.path.join(temp, "out_nb_slides.rst")
res = nb2rst(nbr, outfile)
self.assertEqual(len(res), 1)
for r in res:
self.assertExists(r)
开发者ID:sdpython,项目名称:pyquickhelper,代码行数:28,代码来源:test_notebooks_api.py
示例12: test_rst2html_autoclass
def test_rst2html_autoclass(self):
fLOG(
__file__,
self._testMethodName,
OutputPrint=__name__ == "__main__")
if is_travis_or_appveyor() in ('travis', 'appveyor'):
# It requires latex.
return
if sys.version_info[:2] <= (2, 7):
# i don't want to fix it for Python 2.7
return
content = """
======
title1
======
.. autoclass:: pyquickhelper.sphinxext.sphinx_runpython_extension.RunPythonDirective
:members:
""".replace(" ", "")
temp = get_temp_folder(__file__, "temp_rst2html_autoclass")
text = rst2html(content, outdir=temp, layout="sphinx", writer="rst")
ji = os.path.join(temp, "out.rst")
with open(ji, "w", encoding="utf-8") as f:
f.write(text)
self.assertIn("* ``:indent:<int>`` to indent the output", text)
开发者ID:sdpython,项目名称:pyquickhelper,代码行数:30,代码来源:test_rst2html_toc.py
示例13: test_rst2html_png_bug
def test_rst2html_png_bug(self):
fLOG(
__file__,
self._testMethodName,
OutputPrint=__name__ == "__main__")
if is_travis_or_appveyor() in ('travis', 'appveyor'):
# It requires latex.
return
if sys.version_info[:2] <= (2, 7):
# i don't want to fix it for Python 2.7
return
temp = get_temp_folder(__file__, "temp_rst2html_png_latex")
rst = os.path.join(os.path.abspath(
os.path.dirname(__file__)), "data", "puzzle_girafe.rst")
with open(rst, "r", encoding="utf-8") as f:
content = f.read()
text = rst2html(content, fLOG=fLOG, outdir=temp, warnings_log=True,
imgmath_latex_preamble="""
\\newcommand{\\acc}[1]{\\left\\{#1\\right\\}}
\\newcommand{\\cro}[1]{\\left[#1\\right]}
\\newcommand{\\pa}[1]{\\left(#1\\right)}
\\newcommand{\\girafedec}[3]{ \\begin{array}{ccccc} #1 &=& #2 &+& #3 \\\\ a' &=& a &-& o \\end{array}}
\\newcommand{\\vecteur}[2]{\\pa{#1,\\dots,#2}}
\\newcommand{\\R}[0]{\\mathbb{R}}
\\newcommand{\\N}[0]{\\mathbb{N}}
""")
# fLOG(text)
ji = os.path.join(temp, "out.html")
with open(ji, "w", encoding="utf-8") as f:
f.write(text)
开发者ID:sdpython,项目名称:pyquickhelper,代码行数:33,代码来源:test_rst2html_latex.py
示例14: test_notebook_runner_2a_eco_nlp_long
def test_notebook_runner_2a_eco_nlp_long(self):
fLOG(
__file__,
self._testMethodName,
OutputPrint=__name__ == "__main__")
if is_travis_or_appveyor():
# Requires authentification.
return
from ensae_teaching_cs.automation.notebook_test_helper import ls_notebooks, execute_notebooks, clean_function_1a
from ensae_teaching_cs.data import simple_database
temp = get_temp_folder(__file__, "temp_notebook2a_eco_nlp_long")
keepnote = ls_notebooks("td2a_eco")
shutil.copy(simple_database(), temp)
folder = os.path.join(temp, "ressources_googleplus")
if not os.path.exists(folder):
os.mkdir(folder)
jsfile = os.path.join(os.path.dirname(keepnote[0]),
"ressources_googleplus", "107033731246200681024.json")
shutil.copy(jsfile, folder)
def filter(i, n):
if "td2a_TD5_Traitement_automatique_des_langues_en_Python" in n:
return True
return False
execute_notebooks(temp, keepnote, filter, fLOG=fLOG,
clean_function=clean_function_1a,
dump=ensae_teaching_cs)
开发者ID:sdpython,项目名称:ensae_teaching_cs,代码行数:31,代码来源:test_LONG_2A_notebook_eco.py
示例15: test_notebook_runner_2a_eco
def test_notebook_runner_2a_eco(self):
fLOG(
__file__,
self._testMethodName,
OutputPrint=__name__ == "__main__")
if is_travis_or_appveyor():
# Requires authentification.
return
from ensae_teaching_cs.automation.notebook_test_helper import ls_notebooks, execute_notebooks, clean_function_1a
from ensae_teaching_cs.data import simple_database
temp = get_temp_folder(__file__, "temp_notebook2a_eco")
keepnote = ls_notebooks("td2a_eco")
shutil.copy(simple_database(), temp)
def filter(i, n):
if "SNCF" in n:
return False
if "Scraping" in n:
return False
if "2.ipynb" in n:
return False
if "flask" in n.lower():
# flask from a notebook does not work
return False
if "td2a_TD5_Traitement_automatique_des_langues_en_Python" in n:
return False
return True
execute_notebooks(temp, keepnote,
filter,
fLOG=fLOG,
clean_function=clean_function_1a,
dump=ensae_teaching_cs)
开发者ID:sdpython,项目名称:ensae_teaching_cs,代码行数:35,代码来源:test_2A_notebook_eco.py
示例16: test_status_helper
def test_status_helper(self):
fLOG(
__file__,
self._testMethodName,
OutputPrint=__name__ == "__main__")
res = get_installed_modules(
fLOG=fLOG, stop=10, pypi=True, short_list=["pep8"])
for f in res:
fLOG(f)
if sys.version_info[0] > 2:
if is_travis_or_appveyor():
self.assertEqual(len(res), 1)
else:
warnings.warn(
"This test does not work well on a virtual environment [TestStatusHelper].")
res = get_installed_modules(
fLOG=fLOG, stop=10, pypi=True, short_list=["dataspyre"])
fLOG(res)
res = get_installed_modules(fLOG=fLOG, stop=10, pypi=True)
for f in res:
fLOG(f)
if sys.version_info[0] == 2:
# we disable the test for Python 2.7
warnings.warn(
"TestStatusHelper.test_status_helper disabled on Python 2.7")
return
self.assertEqual(len(res), 10)
开发者ID:sdpython,项目名称:pymyinstall,代码行数:30,代码来源:test_status_helper.py
示例17: test_install_deps
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)
开发者ID:sdpython,项目名称:pymyinstall,代码行数:26,代码来源:test_pymy_deps_cli.py
示例18: test_notebook_read_write
def test_notebook_read_write(self):
fLOG(
__file__,
self._testMethodName,
OutputPrint=__name__ == "__main__")
temp = get_temp_folder(__file__, "temp_notebook_read_write")
nbfile = os.path.join(temp, "..", "data", "simple_example.ipynb")
self.assertTrue(os.path.exists(nbfile))
# For some reason, if this instruction is included in the build,
# the travis build completes but never ends.
# This is removed from the whole list on tavis.
if is_travis_or_appveyor() == "travis":
# This test prevents travis from ending. The process never stops.
return
nb = read_nb(nbfile, kernel=False)
outfile = os.path.join(temp, "out_notebook.ipynb")
nb.to_json(outfile)
assert os.path.exists(outfile)
with open(nbfile, "r", encoding="utf8") as f:
c1 = f.read().replace("\r", "")
with open(outfile, "r", encoding="utf8") as f:
c2 = f.read().replace("\r", "")
if c1 != c2:
l1 = c1.strip("\n ").split("\n")
l2 = c2.strip("\n ").split("\n")
for i, cc in enumerate(zip(l1, l2)):
a, b = cc
if a.strip(" \n") != b.strip(" \n"):
raise Exception(
"difference at line {0}\n1: [{1}]-[{3}]\n2: [{2}]-[{4}]".format(i, a, b, type(a), type(b)))
if len(l1) != len(l2):
raise Exception("different length")
开发者ID:sdpython,项目名称:pyquickhelper,代码行数:33,代码来源:test_notebook_read_write.py
示例19: test_joined_schemas
def test_joined_schemas(self):
fLOG(
__file__,
self._testMethodName,
OutputPrint=__name__ == "__main__")
if is_travis_or_appveyor() == "appveyor":
warnings.warn("disabled on appveyor")
return
temp = get_temp_folder(__file__, "temp_joined_schemas")
try:
df = merge_schema()
except PasswordException:
# the password is not available on this machine
return
assert len(df) > 0
outexc = os.path.join(temp, "schemas.xlsx")
df.to_excel(outexc, index=False)
fLOG(df.columns)
txt = df2rsthtml(df, format="rst")
assert "nan\t" not in txt
fLOG("\n" + txt)
outfile = os.path.join(temp, "schemas.rst")
with open(outfile, "w", encoding="utf-8") as f:
f.write(txt)
开发者ID:sdpython,项目名称:ensae_projects,代码行数:25,代码来源:test_croix_rouge.py
注:本文中的pyquickhelper.pycode.is_travis_or_appveyor函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论