|
16 | 16 |
|
17 | 17 | def test_props():
|
18 | 18 |
|
19 |
| - with importlib.resources.as_file( |
20 |
| - importlib.resources.files("pylivestream.data").joinpath("bunny.avi") |
21 |
| - ) as fn: |
22 |
| - S = pls.FileIn(ini, websites=sites, infn=fn) |
23 |
| - for s in S.streams: |
24 |
| - assert "-re" in S.streams[s].cmd |
25 |
| - assert S.streams[s].fps == approx(24.0) |
| 19 | + vid = importlib.resources.files("pylivestream.data").joinpath("bunny.avi") |
| 20 | + S = pls.FileIn(ini, websites=sites, infn=vid) |
| 21 | + for s in S.streams: |
| 22 | + assert "-re" in S.streams[s].cmd |
| 23 | + assert S.streams[s].fps == approx(24.0) |
26 | 24 |
|
27 |
| - if int(S.streams[s].res[1]) == 480: |
28 |
| - assert S.streams[s].video_kbps == 500 |
29 |
| - elif int(S.streams[s].res[1]) == 720: |
30 |
| - assert S.streams[s].video_kbps == 1800 |
| 25 | + if int(S.streams[s].res[1]) == 480: |
| 26 | + assert S.streams[s].video_kbps == 500 |
| 27 | + elif int(S.streams[s].res[1]) == 720: |
| 28 | + assert S.streams[s].video_kbps == 1800 |
31 | 29 |
|
32 | 30 |
|
33 | 31 | def test_audio():
|
34 | 32 |
|
35 |
| - with ( |
36 |
| - importlib.resources.as_file( |
37 |
| - importlib.resources.files("pylivestream.data").joinpath("logo.png") |
38 |
| - ) as logo, |
39 |
| - importlib.resources.as_file( |
40 |
| - importlib.resources.files("pylivestream.data").joinpath("orch_short.ogg") |
41 |
| - ) as fn, |
42 |
| - ): |
43 |
| - S = pls.FileIn(ini, websites=sites, infn=fn, image=logo) |
44 |
| - for s in S.streams: |
45 |
| - assert "-re" in S.streams[s].cmd |
46 |
| - assert S.streams[s].fps is None |
| 33 | + logo = importlib.resources.files("pylivestream.data").joinpath("logo.png") |
| 34 | + snd = importlib.resources.files("pylivestream.data").joinpath("orch_short.ogg") |
47 | 35 |
|
48 |
| - assert S.streams[s].video_kbps == 800 |
| 36 | + S = pls.FileIn(ini, websites=sites, infn=snd, image=logo) |
| 37 | + for s in S.streams: |
| 38 | + assert "-re" in S.streams[s].cmd |
| 39 | + assert S.streams[s].fps is None |
| 40 | + |
| 41 | + assert S.streams[s].video_kbps == 800 |
49 | 42 |
|
50 | 43 |
|
51 | 44 | @pytest.mark.timeout(TIMEOUT)
|
52 | 45 | @pytest.mark.skipif(CI, reason="CI has no audio hardware typically")
|
53 | 46 | def test_simple():
|
54 | 47 | """stream to localhost"""
|
55 |
| - with ( |
56 |
| - importlib.resources.as_file( |
57 |
| - importlib.resources.files("pylivestream.data").joinpath("logo.png") |
58 |
| - ) as logo, |
59 |
| - importlib.resources.as_file( |
60 |
| - importlib.resources.files("pylivestream.data").joinpath("orch_short.ogg") |
61 |
| - ) as fn, |
62 |
| - ): |
63 |
| - S = pls.FileIn(ini, websites="localhost", infn=fn, image=logo, yes=True, timeout=5) |
| 48 | + logo = importlib.resources.files("pylivestream.data").joinpath("logo.png") |
| 49 | + aud = importlib.resources.files("pylivestream.data").joinpath("orch_short.ogg") |
| 50 | + |
| 51 | + S = pls.FileIn(ini, websites="localhost", infn=aud, image=logo, yes=True, timeout=5) |
64 | 52 |
|
65 |
| - S.golive() |
| 53 | + S.golive() |
66 | 54 |
|
67 | 55 |
|
68 | 56 | @pytest.mark.skipif(CI, reason="CI has no audio hardware typically")
|
69 | 57 | def test_script():
|
70 |
| - with importlib.resources.as_file( |
71 |
| - importlib.resources.files("pylivestream.data").joinpath("bunny.avi") |
72 |
| - ) as fn: |
73 |
| - subprocess.check_call( |
74 |
| - [ |
75 |
| - sys.executable, |
76 |
| - "-m", |
77 |
| - "pylivestream.fglob", |
78 |
| - str(fn), |
79 |
| - "localhost", |
80 |
| - str(ini), |
81 |
| - "--yes", |
82 |
| - "--timeout", |
83 |
| - "5", |
84 |
| - ], |
85 |
| - timeout=TIMEOUT, |
86 |
| - ) |
| 58 | + vid = importlib.resources.files("pylivestream.data").joinpath("bunny.avi") |
| 59 | + subprocess.check_call( |
| 60 | + [ |
| 61 | + sys.executable, |
| 62 | + "-m", |
| 63 | + "pylivestream.fglob", |
| 64 | + str(vid), |
| 65 | + "localhost", |
| 66 | + str(ini), |
| 67 | + "--yes", |
| 68 | + "--timeout", |
| 69 | + "5", |
| 70 | + ], |
| 71 | + timeout=TIMEOUT, |
| 72 | + ) |
0 commit comments