Permalink
Browse files

move unit tests

  • Loading branch information...
sdpython committed Jan 21, 2018
1 parent 4656e45 commit c4930e370e5ea745cb7f9cf455bd701f4fa9dd0c
View
@@ -15,7 +15,8 @@ script:
- { CMD: "python -u setup.py unittests -e \".*noenv2.*\"", NAME: "UT_NOENV2" }
- { CMD: "python -u setup.py unittests -e \".*noenv3.*\"", NAME: "UT_NOENV3" }
- { CMD: "python -u setup.py unittests -e \".*noenv4.*\"", NAME: "UT_NOENV4" }
- { CMD: "python -u setup.py unittests -e \".*noenv4.*\"", NAME: "UT_NOENV5" }
- { CMD: "python -u setup.py unittests -e \".*noenv5.*\"", NAME: "UT_NOENV5" }
- { CMD: "python -u setup.py unittests -e \".*noenv6.*\"", NAME: "UT_NOENV6" }
- { CMD: "python -X faulthandler -X showrefcount -u setup.py unittests_LONG", NAME: "UT_LONG" }
- { CMD: "python -X faulthandler -X showrefcount -u setup.py unittests_SKIP", NAME: "UT_SKIP" }
after_script:
@@ -49,25 +49,7 @@
from src.code_beatrix.art.video import video_save, video_text, video_position, video_compose, video_image, clean_video
class TestVideoText(ExtTestCase):
def test_video_text(self):
fLOG(
__file__,
self._testMethodName,
OutputPrint=__name__ == "__main__")
temp = get_temp_folder(__file__, "temp_video_text")
vid = img = video_text('boule')
exp = os.path.join(temp, "courte.mp4")
video_save(vid, exp, fps=20, duration=3)
self.assertExists(exp)
clean_video(vid)
exp = os.path.join(temp, "courtefct.mp4")
vid = video_position(img, lambda t: (t * 0.1, t * 0.2), relative=True)
video_save(vid, exp, fps=20, duration=4)
self.assertExists(exp)
clean_video(vid)
class TestVideoTextImage(ExtTestCase):
def test_video_text_image(self):
fLOG(
@@ -88,8 +70,10 @@ def test_video_text_image(self):
comb = video_compose([vidimg, text], t1=[0, 1])
exp1 = os.path.join(temp, "courte_text.mp4")
exp2 = os.path.join(temp, "courte_laga.mp4")
video_save(text, exp1, fps=20, duration=5)
video_save(comb, exp2, fps=20, duration=5)
video_save(text, exp1, fps=20, duration=5,
verbose=__name__ == "__main__")
video_save(comb, exp2, fps=20, duration=5,
verbose=__name__ == "__main__")
self.assertExists(exp1)
self.assertExists(exp2)
clean_video([text, text0, comb, vidimg, vidimg0])
@@ -0,0 +1,76 @@
# -*- coding: utf-8 -*-
"""
@brief test log(time=1000s)
Duraction is around a few seconds but the test needs to be run
at the end of the series of unitests as it interferes
with the notebook unittesting (it uses Popen too).
"""
import sys
import os
import unittest
try:
import pyquickhelper
except ImportError:
path = os.path.normpath(
os.path.abspath(
os.path.join(
os.path.split(__file__)[0],
"..",
"..",
"..",
"pyquickhelper",
"src")))
if path not in sys.path:
sys.path.append(path)
import pyquickhelper
try:
import src
except ImportError:
path = os.path.normpath(
os.path.abspath(
os.path.join(
os.path.split(__file__)[0],
"..",
"..")))
if path not in sys.path:
sys.path.append(path)
import src
from pyquickhelper.loghelper import fLOG
from pyquickhelper.pycode import get_temp_folder, ExtTestCase
from src.code_beatrix.art.video import video_save, video_text, video_position, clean_video
class TestVideoText(ExtTestCase):
def test_video_text(self):
fLOG(
__file__,
self._testMethodName,
OutputPrint=__name__ == "__main__")
temp = get_temp_folder(__file__, "temp_video_text")
vid = img = video_text('boule')
exp = os.path.join(temp, "courte.mp4")
video_save(vid, exp, fps=20, duration=3,
verbose=__name__ == "__main__")
self.assertExists(exp)
clean_video(vid)
exp = os.path.join(temp, "courtefct.mp4")
vid = video_position(img, lambda t: (t * 0.1, t * 0.2), relative=True)
video_save(vid, exp, fps=20, duration=4,
verbose=__name__ == "__main__")
self.assertExists(exp)
clean_video(vid)
if __name__ == "__main__":
unittest.main()

0 comments on commit c4930e3

Please sign in to comment.