|
|
@ -1,5 +1,6 @@ |
|
|
|
#!/usr/bin/env python3 |
|
|
|
#!/usr/bin/env python3 |
|
|
|
import json |
|
|
|
import json |
|
|
|
|
|
|
|
import multiprocessing |
|
|
|
import os |
|
|
|
import os |
|
|
|
import requests |
|
|
|
import requests |
|
|
|
import shutil |
|
|
|
import shutil |
|
|
@ -12,7 +13,6 @@ from datetime import datetime, timedelta |
|
|
|
from parameterized import parameterized |
|
|
|
from parameterized import parameterized |
|
|
|
from typing import Optional |
|
|
|
from typing import Optional |
|
|
|
|
|
|
|
|
|
|
|
from multiprocessing import Process |
|
|
|
|
|
|
|
from pympler.tracker import SummaryTracker |
|
|
|
from pympler.tracker import SummaryTracker |
|
|
|
from unittest import mock |
|
|
|
from unittest import mock |
|
|
|
from websocket import ABNF |
|
|
|
from websocket import ABNF |
|
|
@ -75,24 +75,25 @@ class TestAthenadMethods(unittest.TestCase): |
|
|
|
with self.assertRaises(TimeoutError) as _: |
|
|
|
with self.assertRaises(TimeoutError) as _: |
|
|
|
dispatcher["getMessage"]("controlsState") |
|
|
|
dispatcher["getMessage"]("controlsState") |
|
|
|
|
|
|
|
|
|
|
|
def send_deviceState(): |
|
|
|
end_event = multiprocessing.Event() |
|
|
|
messaging.context = messaging.Context() |
|
|
|
|
|
|
|
pub_sock = messaging.pub_sock("deviceState") |
|
|
|
pub_sock = messaging.pub_sock("deviceState") |
|
|
|
start = time.time() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while time.time() - start < 1: |
|
|
|
def send_deviceState(): |
|
|
|
|
|
|
|
while not end_event.is_set(): |
|
|
|
msg = messaging.new_message('deviceState') |
|
|
|
msg = messaging.new_message('deviceState') |
|
|
|
pub_sock.send(msg.to_bytes()) |
|
|
|
pub_sock.send(msg.to_bytes()) |
|
|
|
time.sleep(0.01) |
|
|
|
time.sleep(0.01) |
|
|
|
|
|
|
|
|
|
|
|
p = Process(target=send_deviceState) |
|
|
|
p = multiprocessing.Process(target=send_deviceState) |
|
|
|
p.start() |
|
|
|
p.start() |
|
|
|
time.sleep(0.1) |
|
|
|
time.sleep(0.1) |
|
|
|
try: |
|
|
|
try: |
|
|
|
deviceState = dispatcher["getMessage"]("deviceState") |
|
|
|
deviceState = dispatcher["getMessage"]("deviceState") |
|
|
|
assert deviceState['deviceState'] |
|
|
|
assert deviceState['deviceState'] |
|
|
|
finally: |
|
|
|
finally: |
|
|
|
p.terminate() |
|
|
|
end_event.set() |
|
|
|
|
|
|
|
p.join() |
|
|
|
|
|
|
|
|
|
|
|
def test_listDataDirectory(self): |
|
|
|
def test_listDataDirectory(self): |
|
|
|
route = '2021-03-29--13-32-47' |
|
|
|
route = '2021-03-29--13-32-47' |
|
|
|