-
Notifications
You must be signed in to change notification settings - Fork 70
/
Copy pathtest_local_streaming.py
39 lines (26 loc) · 961 Bytes
/
test_local_streaming.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
import time
import unittest
from threading import Thread
import numpy
from StreamViewer import StreamViewer
from Streamer import Streamer
class TestLocalStreaming(unittest.TestCase):
@classmethod
def setUpClass(cls):
super(TestLocalStreaming, cls).setUpClass()
cls.stream_viewer = StreamViewer()
Thread(target=lambda: cls.stream_viewer.receive_stream(display=False)).start()
cls.streamer = Streamer()
Thread(target=lambda: cls.streamer.start()).start()
time.sleep(5)
def test_camera_image(self):
self.assertIsInstance(self.stream_viewer.current_frame, numpy.ndarray)
def test_camera_image_not_null(self):
self.assertIsNotNone(self.stream_viewer.current_frame)
@classmethod
def tearDownClass(cls):
super(TestLocalStreaming, cls).tearDownClass()
cls.streamer.stop()
cls.stream_viewer.stop()
if __name__ == '__main__':
unittest.main()