Video editing with Python
Add Travis support for Python 3.7 and 3.8 (#1018)
Tom Burrows11f0d8dc5652
diff --git a/.travis.yml b/.travis.ymlindex 21ebbdd6..cbd7c42e 100644--- a/.travis.yml+++ b/.travis.yml@@ -1,49 +1,69 @@-dist: trusty-sudo: required+dist: xeniallanguage: pythoncache: pip+os: linux+python:- - "2.7"- - "3.5"- - "3.6"+ - 3.5+ - 3.6+ - 3.7+ - 3.8++jobs:+ include:+ - python: 2.7+ dist: trusty+ before_install:+ - sudo add-apt-repository -y ppa:kirillshkrogalev/ffmpeg-next+ - sudo apt-get -y -qq update+ - sudo apt-get install -y -qq ffmpeg++ # Ensure PIP is up-to-date to avoid warnings.+ - python -m pip install --upgrade pip+ # Ensure setuptools is up-to-date to avoid environment_markers bug.+ - pip install --upgrade setuptools+ # The default pytest that is installed is too old on some platforms, leading to version conflicts+ # pytest-cov contains plugin support for checking code coverage+ - pip install --upgrade pytest-cov+ - pip install flake8++ # modify ImageMagick policy file so that Textclips work correctly.+ # `| sudo tee` replaces `>` so that it can have root permissions+ - cat /etc/ImageMagick/policy.xml | sed 's/none/read,write/g' | sudo tee /etc/ImageMagick/policy.xml+before_install:- - sudo add-apt-repository -y ppa:kirillshkrogalev/ffmpeg-next- sudo apt-get -y -qq update- - sudo apt-get install -y -qq ffmpeg-+# Ensure PIP is up-to-date to avoid warnings.- python -m pip install --upgrade pip# Ensure setuptools is up-to-date to avoid environment_markers bug.- pip install --upgrade setuptools- # The default py that is installed is too old on some platforms, leading to version conflicts- - pip install --upgrade py pytest+ # The default pytest that is installed is too old on some platforms, leading to version conflicts+ # pytest-cov contains plugin support for checking code coverage+ - pip install --upgrade pytest-cov+ - pip install flake8# modify ImageMagick policy file so that Textclips work correctly.# `| sudo tee` replaces `>` so that it can have root permissions- - cat /etc/ImageMagick/policy.xml | sed 's/none/read,write/g' | sudo tee /etc/ImageMagick/policy.xml+ - cat /etc/ImageMagick-6/policy.xml | sed 's/none/read,write/g' | sudo tee /etc/ImageMagick-6/policy.xmlinstall:- - echo "No install action required. Implicitly performed by the testing."- - pip install flake8+ - pip install .[test]before_script:# stop the build if there are Python syntax errors or undefined names- flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics --exit-zero# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide- - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics+ - flake8 . --count --max-complexity=10 --max-line-length=127 --statistics --exit-zeroscript:- - python setup.py test --pytest-args "tests/ --doctest-modules -v --cov moviepy --cov-report term-missing"+ - pytest tests/ --doctest-modules -v --cov moviepy --cov-report term-missing# Now the *code* is tested, let's check that the setup is compatible with PIP without falling over.- pip install -e .- pip install -e .[optional]- pip install -e .[test]- # Only test doc generation on latest. Doesn't work on some earlier versions (3.3), but doesn't matter.- - if [[ $TRAVIS_PYTHON_VERSION == '3.6' ]]; then pip install -e .[doc]; fi+ - pip install -e .[doc]after_success:- coveralls--matrix:- fast_finish: truediff --git a/README.rst b/README.rstindex b1bc4810..2edc1e31 100644--- a/README.rst+++ b/README.rst@@ -166,18 +166,17 @@ Have a look at the Proglog project page for more options.Running Tests--------------The testing suite can be executed via:+In order to run the test suite locally, first install the dependencies by navigating to the project directory and running:.. code:: bash- $ python setup.py test+ $ (sudo) pip install moviepy[test]-Running the test suite in this manner will install the testing dependencies.-If you opt to run the test suite manually, you can install the dependencies via:+The test suite can then be executed via:.. code:: bash- $ (sudo) pip install moviepy[test]+ $ pytestContributediff --git a/setup.py b/setup.pyindex 1a58c031..f8088bb5 100644--- a/setup.py+++ b/setup.py@@ -67,7 +67,8 @@ requires = ["imageio>=2.0,<2.5; python_version<'3.4'","imageio_ffmpeg>=0.2.0; python_version>='3.4'",'tqdm>=4.11.2,<5.0',- 'numpy',+ "numpy>=1.17.3; python_version!='2.7'",+ "numpy; python_version>='2.7'",'requests>=2.8.1,<3.0','proglog<=1.0.0']@@ -76,13 +77,13 @@ optional_reqs = ["opencv-python>=3.0,<4.0; python_version!='2.7'","scikit-image>=0.13.0,<1.0; python_version>='3.4'","scikit-learn; python_version>='3.4'",- "scipy>=0.19.0,<1.0; python_version!='3.3'",+ "scipy>=0.19.0,<1.5; python_version!='3.3'","matplotlib>=2.0.0,<3.0; python_version>='3.4'","youtube_dl"]doc_reqs = [- "pygame>=1.9.3,<2.0; python_version!='3.3'",+ "pygame>=1.9.3,<2.0; python_version<'3.8'",'numpydoc>=0.6.0,<1.0','sphinx_rtd_theme>=0.1.10b0,<1.0','Sphinx>=1.5.2,<2.0',diff --git a/tests/README.rst b/tests/README.rstindex 6a696a7c..fe915de2 100644--- a/tests/README.rst+++ b/tests/README.rst@@ -1,3 +1,3 @@Install testing dependencies: `pip install moviepy[test]`-Run tests: `python setup.py test`+Run tests: `pytest`diff --git a/tests/test_TextClip.py b/tests/test_TextClip.pyindex 376219ae..76f0b422 100644--- a/tests/test_TextClip.py+++ b/tests/test_TextClip.py@@ -6,13 +6,16 @@ from moviepy.utils import close_all_clipsfrom moviepy.video.fx.blink import blinkfrom moviepy.video.VideoClip import TextClip-from .test_helper import TMP_DIR+from .test_helper import FONT-def test_duration():+def test_fontlist():+ TextClip.list('font')+- clip = TextClip('hello world', size=(1280,720), color='white')- clip = clip.set_duration(5) # Changed due to #598.+def test_duration():+ clip = TextClip('hello world', size=(1280,720), color='white', font=FONT)+ clip = clip.set_duration(5)assert clip.duration == 5clip.close()@@ -21,13 +24,15 @@ def test_duration():assert clip2.duration == 5close_all_clips(locals())+# Moved from tests.py. Maybe we can remove these?def test_if_textclip_crashes_in_caption_mode():TextClip(txt='foo', color='white', size=(640, 480), method='caption',- align='center', fontsize=25).close()+ align='center', fontsize=25, font=FONT).close()+def test_if_textclip_crashes_in_label_mode():- TextClip(txt='foo', method='label').close()+ TextClip(txt='foo', method='label', font=FONT).close()if __name__ == '__main__':diff --git a/tests/test_videotools.py b/tests/test_videotools.pyindex 7098a587..217c9718 100644--- a/tests/test_videotools.py+++ b/tests/test_videotools.py@@ -5,7 +5,7 @@ import sysfrom moviepy.video.tools.credits import credits1-from .test_helper import TMP_DIR+from .test_helper import TMP_DIR, FONTdef test_credits():@@ -31,7 +31,7 @@ def test_credits():file.write(credit_file)image = credits1(file_location, 600, gap=100, stroke_color="blue",- stroke_width=5)+ stroke_width=5, font=FONT)image = image.set_duration(3)image.write_videofile(vid_location, fps=24)assert os.path.isfile(vid_location)