Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add skip to animation tests if ffmpeg is not installed #712

Closed
canyon289 opened this issue Jun 19, 2019 · 1 comment · Fixed by #1227
Closed

Add skip to animation tests if ffmpeg is not installed #712

canyon289 opened this issue Jun 19, 2019 · 1 comment · Fixed by #1227
Labels

Comments

@canyon289
Copy link
Member

Describe the bug
Running test suite without ffmpeg in environment will raise numerous failures

To Reproduce
Steps to reproduce the behavior. Ideally a self-contained snippet of code, or link to a notebook or external code. Please include screenshots/images produced with ArviZ here, or the stacktrace including arviz code to help.

image

FWARNING:matplotlib.animation:MovieWriter ffmpeg unavailable. Trying to use html instead.
INFO:matplotlib.animation:Animation.save using <class 'matplotlib.animation.HTMLWriter'>

test_plots.py:559 (test_plot_ppc_save_animation[cumulative])
models = <arviz.tests.test_plots.models..Models object at 0x19a9999b0>
kind = 'cumulative'

@pytest.mark.parametrize("kind", ["density", "cumulative", "scatter"])
def test_plot_ppc_save_animation(models, kind):
    animation_kwargs = {"blit": False}
    axes, anim = plot_ppc(
        models.model_1,
        kind=kind,
        animated=True,
        animation_kwargs=animation_kwargs,
        num_pp_samples=5,
        random_seed=3,
    )
    assert axes
    assert anim
    animations_folder = "saved_animations"
    os.makedirs(animations_folder, exist_ok=True)
    path = os.path.join(animations_folder, "ppc_{}_animation.mp4".format(kind))
  anim.save(path)

test_plots.py:576:


../../../../.miniconda3/envs/arviz/lib/python3.7/site-packages/matplotlib/animation.py:1166: in save
with writer.saving(self._fig, filename, dpi):
../../../../.miniconda3/envs/arviz/lib/python3.7/contextlib.py:112: in enter
return next(self.gen)
../../../../.miniconda3/envs/arviz/lib/python3.7/site-packages/matplotlib/animation.py:228: in saving
self.setup(fig, outfile, dpi, *args, **kwargs)


self = <matplotlib.animation.HTMLWriter object at 0x1ca9415f8>
fig = <Figure size 640x480 with 1 Axes>
outfile = 'saved_animations/ppc_cumulative_animation.mp4', dpi = 100.0
frame_dir = None

def setup(self, fig, outfile, dpi, frame_dir=None):
    root, ext = os.path.splitext(outfile)
    if ext not in ['.html', '.htm']:
      raise ValueError("outfile must be *.htm or *.html")

E ValueError: outfile must be *.htm or *.html

../../../../.miniconda3/envs/arviz/lib/python3.7/site-packages/matplotlib/animation.py:857: ValueError

Expected behavior
Tests should be skipped if ffmpeg is not installed to avoid erroneous failures

Additional context
Versions of arviz and other libraries used, operating system used, and anything else that may be useful.

@OriolAbril
Copy link
Member

Maybe a skipif after having checked is_available?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants