forked from monash-human-power/raspicam
-
Notifications
You must be signed in to change notification settings - Fork 0
/
overlay_error.py
29 lines (20 loc) · 943 Bytes
/
overlay_error.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
from overlay_new import OverlayNew
DEFAULT_TEST_BIKE = "v3"
class OverlayErrorTest(OverlayNew):
"""
Overlay made for testing MQTT error publishing by inheriting OverlayNew
Tests whether an error will be published onto the MQTT Camera Errors topic
"/v3/camera/errors". This overlay should not be used for any purpose other
than error testing. This script should not be triggered by Pytest.
To exit the script, press CTRL+C.
"""
def __init__(self, bike=DEFAULT_TEST_BIKE, bg=None):
super().__init__(bike, bg)
def on_connect(self, client, userdata, flags, rc):
""" Raises an exception which should be caught by _on_connect. """
# Forcing an exception to occur
raise Exception("Test error")
if __name__ == "__main__":
args = OverlayErrorTest.get_overlay_args("Test Overlay")
my_overlay = OverlayErrorTest(args.bike, args.bg)
my_overlay.connect(ip=args.host)