-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathtest_path.py
More file actions
50 lines (35 loc) · 1.17 KB
/
test_path.py
File metadata and controls
50 lines (35 loc) · 1.17 KB
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
import os
import pytest
from ffmpegio import path
def test_find():
print(path.find()) # gotta have ffmpeg to run the tests
ffmpeg_path = path.where()
ffprobe_path = path.where(True)
path.find(ffmpeg_path, ffprobe_path)
with pytest.raises(Exception):
path.find("wrong_dir")
with pytest.raises(Exception):
path.find("wrong_path", ffprobe_path)
with pytest.raises(Exception):
path.find(ffmpeg_path, "wrong_path")
with pytest.raises(Exception):
path.find(None, ffprobe_path)
ffmpeg_dir = os.path.dirname(ffmpeg_path)
if ffmpeg_dir != "":
path.find(ffmpeg_dir)
def test_found():
assert path.found() # assuming ffmpeg is found in a default place
def test_where():
assert path.where() is not None # assuming ffmpeg is found
def test_versions():
assert "version" in path.versions()
def test_check_version():
path.check_version("5.0")
path.check_version("5.0", "==")
path.check_version("5.0", "!=")
path.check_version("5.0", "<")
path.check_version("5.0", ">")
path.check_version("5.0", "<=")
path.check_version("5.0", ">=")
if __name__ == "__main__":
test_find()