本文整理汇总了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函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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)
示例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)
示例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)
示例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))
示例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
示例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()
示例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
示例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")
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)