Skip to content

Commit

Permalink
☂️ CI: Improved code coverage for StreamGear
Browse files Browse the repository at this point in the history
- 🔥 Removed unused imports.
  • Loading branch information
abhiTronix committed May 31, 2024
1 parent bfc521d commit abeb955
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
6 changes: 3 additions & 3 deletions vidgear/tests/streamer_tests/test_IO_rtf.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
limitations under the License.
===============================================
"""
# import the necessary packages

import numpy as np
# import the necessary packages
import pytest
import numpy as np
from vidgear.gears import StreamGear


Expand Down Expand Up @@ -91,7 +91,7 @@ def test_invalid_params_rtf(format):
random_data = np.random.random(size=(480, 640, 3)) * 255
input_data = random_data.astype(np.uint8)

stream_params = {"-vcodec": "unknown"}
stream_params = {"-vcodec": "unknown", "-livestream": "invalid"}
streamer = StreamGear(
output="output{}".format(".mpd" if format == "dash" else ".m3u8"),
format=format,
Expand Down
8 changes: 5 additions & 3 deletions vidgear/tests/streamer_tests/test_IO_ss.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@
limitations under the License.
===============================================
"""
# import the necessary packages

# import the necessary packages
import os
import numpy as np
import pytest
import tempfile
import subprocess
Expand Down Expand Up @@ -76,7 +75,10 @@ def test_paths_ss(path, format):
"""
streamer = None
try:
stream_params = {"-video_source": return_testvideo_path()}
stream_params = {
"-video_source": return_testvideo_path(),
"-livestream": "invalid",
}
streamer = StreamGear(output=path, format=format, logging=True, **stream_params)
except Exception as e:
if isinstance(e, ValueError):
Expand Down
12 changes: 9 additions & 3 deletions vidgear/tests/streamer_tests/test_streamgear_modes.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
limitations under the License.
===============================================
"""
# import the necessary packages

# import the necessary packages
import os
import cv2
import queue
Expand Down Expand Up @@ -257,6 +257,7 @@ def test_ss_livestream(format):
stream_params = {
"-video_source": return_testvideo_path(),
"-livestream": True,
"-clear_prev_assets": "invalid",
"-remove_at_exit": 1,
}
streamer = StreamGear(
Expand Down Expand Up @@ -337,6 +338,7 @@ def test_rtf_livestream(format):
stream = CamGear(source=return_testvideo_path(), **options).start()
stream_params = {
"-livestream": True,
"-enable_force_termination": True,
}
streamer = StreamGear(output=assets_file_path, format=format, **stream_params)
while True:
Expand All @@ -346,7 +348,7 @@ def test_rtf_livestream(format):
break
streamer.stream(frame)
stream.stop()
streamer.close()
streamer.terminate()
except Exception as e:
if not isinstance(e, queue.Empty):
pytest.fail(str(e))
Expand All @@ -367,6 +369,9 @@ def test_input_framerate_rtf(format):
stream_params = {
"-clear_prev_assets": True,
"-input_framerate": test_framerate,
"-vcodec": "copy",
"-vf": "format=yuv420p",
"-aspect": "4:3",
}
if format == "hls":
stream_params.update(
Expand Down Expand Up @@ -416,6 +421,7 @@ def test_input_framerate_rtf(format):
"-bpp": 0.2000,
"-gop": 125,
"-vcodec": "libx265",
"-enable_force_termination": "invalid",
},
"hls",
),
Expand Down Expand Up @@ -698,7 +704,7 @@ def test_audio(stream_params, format):
)
def test_multistreams(format, stream_params):
"""
Testing Support for additional Secondary Streams of variable bitrates or spatial resolutions.
Testing Support for additional Secondary Streams of variable bitrate or spatial resolutions.
"""
assets_file_path = os.path.join(
return_assets_path(False if format == "dash" else True),
Expand Down

0 comments on commit abeb955

Please sign in to comment.