-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtlmm-tests-current.py
executable file
·81 lines (61 loc) · 2.04 KB
/
tlmm-tests-current.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import subprocess
from inspect import getsourcefile
from os.path import abspath
import unittest
from tl import *
import shutil
import logging
from datetime import timedelta # class!
import filebyday
logger = logging.getLogger(__name__)
class Test(unittest.TestCase):
def datadir(self):
mydir = os.path.dirname(abspath(getsourcefile(lambda: 0)))
return os.path.join(mydir, "testdata")
def setUp(self):
# warnings.simplefilter("ignore", ResourceWarning)
os.chdir(self.datadir())
def test_filebydate(self):
try:
shutil.rmtree("temp-filebyday")
except Exception as e:
print (e)
pass
shutil.copytree("filebyday","temp-filebyday")
__name__ = "main"
filebyday
def tearDown(self):
pass
def test_ignore_valid(self):
l = logging.getLogger("tl").level
# expect warnings of invalid files
logging.getLogger("tl").setLevel(logging.ERROR)
mm = VideoMakerDay()
mm.files_from_glob(["invalid/*.jpg"])
mm.load_videos()
logging.getLogger("tl").setLevel(l)
def test_ignore_last(self):
return
mm = VideoMakerDay()
mm.ignore_last = True
mm.files_from_glob(["3days1h/*.jpg"])
mm.load_videos()
print(mm)
def test_graph(self):
return
mm = VideoMakerConcat()
mm.files_from_glob(["3days1m/*.jpg"])
mm.load_videos()
mm.graph_intervals(timedelta(seconds=3600))
def test_frames(self):
self.assertEqual(frames("samplemovies/sample1.mp4"),55)
self.assertEqual(frames("samplemovies/sample2.mp4"), 444)
def test_fps(self):
self.assertEqual(fps("samplemovies/sample1.mp4"),1)
self.assertEqual(fps("samplemovies/sample2.mp4"), 20)
if __name__ == "__main__":
print("Starting unit tests")
# import sys;sys.argv = ['', 'Test.testHelp']
logger.setLevel(logging.DEBUG)
logging.basicConfig(format='%(levelname)s:%(message)s')
unittest.main(verbosity=2)