Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf5392d6

Browse files
committed
Add some animation tests.
1 parentd610a5d commitf5392d6

File tree

6 files changed

+44
-37
lines changed

6 files changed

+44
-37
lines changed

‎.appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ install:
6363
-activate test-environment
6464
-echo %PYTHON_VERSION% %TARGET_ARCH%
6565
# pytest-cov>=2.3.1 due to https://github.com/pytest-dev/pytest-cov/issues/124
66-
-pip install -q "pytest!=3.3.0,>=3.2.0" "pytest-cov>=2.3.1" pytest-rerunfailures pytest-timeout pytest-xdist
66+
-pip install -q "pytest>=3.3.1" "pytest-cov>=2.3.1" pytest-rerunfailures pytest-timeout pytest-xdist
6767

6868
# Apply patch to `subprocess` on Python versions > 2 and < 3.6.3
6969
# https://github.com/matplotlib/matplotlib/issues/9176

‎.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ env:
5252
-NUMPY=numpy
5353
-PANDAS=
5454
-PYPARSING=pyparsing
55-
-PYTEST='pytest!=3.3.0,>=3.2.0'
55+
-PYTEST='pytest>=3.3.1'
5656
-PYTEST_COV=pytest-cov
5757
-PYTEST_PEP8=
5858
-SPHINX=sphinx
@@ -74,7 +74,7 @@ matrix:
7474
-NUMPY=numpy==1.10.0
7575
-PANDAS='pandas<0.21.0'
7676
-PYPARSING=pyparsing==2.0.1
77-
-PYTEST=pytest==3.1.0
77+
-PYTEST=pytest==3.3.1
7878
-PYTEST_COV=pytest-cov==2.3.1
7979
-SPHINX=sphinx==1.3
8080
-python:3.5

‎doc/devel/contributing.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ environment is set up properly::
151151

152152
..note::
153153

154-
**Additional dependencies for testing**:pytest_ (version 3.1 or later),
154+
**Additional dependencies for testing**:pytest_ (version 3.3.1 or later),
155155
Ghostscript_,Inkscape_
156156

157157
..seealso::

‎doc/devel/testing.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ local FreeType build
2525

2626
The following software is required to run the tests:
2727

28-
-pytest_ (>=3.1)
28+
-pytest_ (>=3.3.1)
2929
-Ghostscript_ (to render PDF files)
3030
-Inkscape_ (to render SVG files)
3131

‎lib/matplotlib/tests/test_animation.py

Lines changed: 38 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
from __future__importabsolute_import,division,print_function
2-
3-
importsix
4-
1+
frompathlibimportPath
52
importsys
63
importtempfile
74

@@ -42,25 +39,30 @@ def finish(self):
4239
pass
4340

4441

45-
deftest_null_movie_writer():
46-
# Test running an animation with NullMovieWriter.
47-
48-
fig=plt.figure()
42+
defmake_animation(**kwargs):
43+
fig,ax=plt.subplots()
44+
line,=ax.plot([])
4945

5046
definit():
5147
pass
5248

5349
defanimate(i):
54-
pass
50+
line.set_data([0,1], [0,i])
51+
returnline,
52+
53+
returnanimation.FuncAnimation(fig,animate,**kwargs)
54+
55+
56+
deftest_null_movie_writer():
57+
# Test running an animation with NullMovieWriter.
58+
59+
anim=make_animation(frames=5)
5560

56-
num_frames=5
5761
filename="unused.null"
5862
dpi=50
5963
savefig_kwargs=dict(foo=0)
60-
61-
anim=animation.FuncAnimation(fig,animate,init_func=init,
62-
frames=num_frames)
6364
writer=NullMovieWriter()
65+
6466
anim.save(filename,dpi=dpi,writer=writer,
6567
savefig_kwargs=savefig_kwargs)
6668

@@ -178,23 +180,8 @@ def animate(i):
178180

179181

180182
deftest_no_length_frames():
181-
fig,ax=plt.subplots()
182-
line,=ax.plot([], [])
183-
184-
definit():
185-
line.set_data([], [])
186-
returnline,
187-
188-
defanimate(i):
189-
x=np.linspace(0,10,100)
190-
y=np.sin(x+i)
191-
line.set_data(x,y)
192-
returnline,
193-
194-
anim=animation.FuncAnimation(fig,animate,init_func=init,
195-
frames=iter(range(5)))
196-
writer=NullMovieWriter()
197-
anim.save('unused.null',writer=writer)
183+
(make_animation(frames=iter(range(5)))
184+
.save('unused.null',writer=NullMovieWriter()))
198185

199186

200187
deftest_movie_writer_registry():
@@ -212,10 +199,30 @@ def test_movie_writer_registry():
212199
assertnotanimation.writers.is_available("ffmpeg")
213200
# something which is guaranteed to be available in path
214201
# and exits immediately
215-
bin=u"true"ifsys.platform!='win32'elseu"where"
202+
bin="true"ifsys.platform!='win32'else"where"
216203
mpl.rcParams['animation.ffmpeg_path']=bin
217204
assertanimation.writers._dirty
218205
animation.writers.list()# resets
219206
assertnotanimation.writers._dirty
220207
assertanimation.writers.is_available("ffmpeg")
221208
mpl.rcParams['animation.ffmpeg_path']=ffmpeg_path
209+
210+
211+
@pytest.mark.parametrize("method_name", ["to_html5_video","to_jshtml"])
212+
deftest_embed_limit(method_name,caplog):
213+
mpl.rcParams["animation.embed_limit"]=1e-6# Approximately 1 byte.
214+
getattr(make_animation(frames=1),method_name)()
215+
assertlen(caplog.records)==1
216+
record,=caplog.records
217+
assert (record.name=="matplotlib.animation"
218+
andrecord.levelname=="WARNING")
219+
220+
221+
@pytest.mark.parametrize(
222+
"method_name",
223+
["to_html5_video",
224+
pytest.mark.xfail("to_jshtml")])# Needs to be fixed.
225+
deftest_cleanup_temporaries(method_name,tmpdir):
226+
withtmpdir.as_cwd():
227+
getattr(make_animation(frames=1),method_name)()
228+
assertlist(Path(tmpdir).iterdir())== []

‎setupext.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,7 @@ def get_namespace_packages(self):
739739

740740
classTests(OptionalPackage):
741741
name="tests"
742-
pytest_min_version='3.1'
742+
pytest_min_version='3.3.1'
743743
default_config=False
744744

745745
defcheck(self):

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp