Video editing with Python
add test_compositing.py (#451)
Billy Earney16d33e3e20b0
diff --git a/.travis.yml b/.travis.ymlindex f0fb6b1b..e117f29f 100644--- a/.travis.yml+++ b/.travis.yml@@ -1,3 +1,4 @@+dist: Trustylanguage: pythonpython:- "2.7"@@ -7,7 +8,8 @@ python:- "3.6"# command to install dependenciesbefore_install:- - sudo apt-get -qq update+ - sudo add-apt-repository -y ppa:kirillshkrogalev/ffmpeg-next+ - sudo apt-get -y update- sudo apt-get install -y ffmpeg- mkdir mediainstall:diff --git a/tests/test_compositing.py b/tests/test_compositing.pynew file mode 100644index 00000000..7dd1ee2a--- /dev/null+++ b/tests/test_compositing.py@@ -0,0 +1,35 @@+import pytest+from moviepy.editor import *++def test_clips_array():+ _red = ColorClip((1024,800), col=(255,0,0))+ _green = ColorClip((1024,800), col=(0,255,0))+ _blue = ColorClip((1024,800), col=(0,0,255))++ _video = clips_array([[_red, _green, _blue]])++ with pytest.raises(ValueError,+ message="Expecting ValueError (duration not set)"):+ _video.resize(width=480).write_videofile("/tmp/test_clips_array.mp4")+++def test_clips_array():+ _red = ColorClip((1024,800), col=(255,0,0))+ _green = ColorClip((1024,800), col=(0,255,0))+ _blue = ColorClip((1024,800), col=(0,0,255))++ _video = clips_array([[_red, _green, _blue]]).set_duration(5)++ with pytest.raises(AttributeError,+ message="Expecting ValueError (fps not set)"):+ _video.write_videofile("/tmp/test_clips_array.mp4")+++ #this one should work correctly+ _red.fps=_green.fps=_blue.fps=30+ _video = clips_array([[_red, _green, _blue]]).set_duration(5)+ _video.write_videofile("/tmp/test_clips_array.mp4")+++if __name__ == '__main__':+ pytest.main()diff --git a/tests/test_tools.py b/tests/test_tools.pyindex 21efeb34..31cde521 100644--- a/tests/test_tools.py+++ b/tests/test_tools.py@@ -64,7 +64,7 @@ def test_5():start = time.time()tools.sys_write_flush("hello world")myTime = time.time() - start- assert myTime < 0.0001+ assert myTime < 0.001file = sys.stdout.read()assert file == b""