-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Reset the available animation movie writer on rcParam change #5628
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
e3e2be9
Reset the available animation movie writer on rcParam change
jankatins 6a01829
TST: Use a better command for annimation tests
jankatins 6c6cf91
Fix: rerun check for imagemagick in isAvailable
jankatins 96b439a
fix spelling
jankatins 9b61b34
FIX: add debugging output when the MovieWriter fails
jankatins 33f564a
Pep8 fixes
jankatins e783867
Add comment to explain the fix in ImageMagickBase
jankatins File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
Reset the available animation movie writer on rcParam change
If one of the rcParams for a path to a program, which was called by a movie writer, is changed, the the available movie writer in the registry should be reevaluated if they are (still/became) available. This also fixes the problem that you have to set the path to a movie writer before importing mpl.animation, as before the state was fixed on import time.
- Loading branch information
commit e3e2be95ce8ab60c5c00944ce1dc593e4ac9487c
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,10 +4,13 @@ | |
from matplotlib.externals import six | ||
|
||
import os | ||
import sys | ||
import tempfile | ||
import numpy as np | ||
from numpy.testing import assert_equal | ||
from nose import with_setup | ||
from nose.tools import assert_false, assert_true | ||
import matplotlib as mpl | ||
from matplotlib import pyplot as plt | ||
from matplotlib import animation | ||
from matplotlib.testing.noseclasses import KnownFailureTest | ||
|
@@ -163,6 +166,29 @@ def animate(i): | |
frames=iter(range(5))) | ||
|
||
|
||
def test_movie_writer_registry(): | ||
ffmpeg_path = mpl.rcParams['animation.ffmpeg_path'] | ||
# Not sure about the first state as there could be some writer | ||
# which set rcparams | ||
#assert_false(animation.writers._dirty) | ||
assert_true(len(animation.writers._registered) > 0) | ||
animation.writers.list() # resets dirty state | ||
assert_false(animation.writers._dirty) | ||
mpl.rcParams['animation.ffmpeg_path'] = u"not_available_ever_xxxx" | ||
assert_true(animation.writers._dirty) | ||
animation.writers.list() # resets | ||
assert_false(animation.writers._dirty) | ||
assert_false(animation.writers.is_available("ffmpeg")) | ||
# something which is garanteered to be available in path | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "garanteered"? |
||
bin = u"python" | ||
mpl.rcParams['animation.ffmpeg_path'] = bin | ||
assert_true(animation.writers._dirty) | ||
animation.writers.list() # resets | ||
assert_false(animation.writers._dirty) | ||
assert_true(animation.writers.is_available("ffmpeg")) | ||
mpl.rcParams['animation.ffmpeg_path'] = ffmpeg_path | ||
|
||
|
||
if __name__ == "__main__": | ||
import nose | ||
nose.runmodule(argv=['-s', '--with-doctest'], exit=False) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW: should that be "is_available"? It's the only method in that class(es) which use CamelCase instead of underscores...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is annoying, but I don't think worth breaking user code over.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At most, we can rename and add an alias
isAvailable
->is_available
with the@deprecated
decorator.