Skip to content

Commit bfd3452

Browse files
Test suite
1 parent cee17b3 commit bfd3452

File tree

2 files changed

+41
-25
lines changed

2 files changed

+41
-25
lines changed

tests/fixtures/mqtt_client_fixture.py

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11,31 +11,30 @@
1111

1212
@pytest.fixture
1313
def offloading_data_fixture(monkeypatch):
14-
""" Fixture to override OffloadingDataFiles paths for all tests. """
14+
"""Fixture to override OffloadingDataFiles paths for all tests."""
1515
base_path = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
16-
monkeypatch.setattr(OffloadingDataFiles, "data_file_path_device",
17-
os.path.join(base_path, TestSamples.data_file_path_device))
18-
monkeypatch.setattr(OffloadingDataFiles, "data_file_path_edge",
19-
os.path.join(base_path, TestSamples.data_file_path_edge))
20-
monkeypatch.setattr(OffloadingDataFiles, "data_file_path_sizes",
21-
os.path.join(base_path, TestSamples.data_file_path_sizes))
16+
monkeypatch.setattr(
17+
OffloadingDataFiles,
18+
"data_file_path_sizes",
19+
os.path.join(base_path, TestSamples.data_file_path_sizes),
20+
)
2221

2322
return OffloadingDataFiles # Optional: return for reference if needed
2423

2524

2625
@pytest.fixture
2726
def mqtt_client_fixture(offloading_data_fixture):
28-
""" Fixture to create an MQTT client with overridden file paths. """
29-
broker_url = 'hostname.local'
27+
"""Fixture to create an MQTT client with overridden file paths."""
28+
broker_url = "hostname.local"
3029
broker_port = 1883
31-
client_id = 'edge'
30+
client_id = "edge"
3231
topics = {
33-
'registration': 'devices/',
34-
'offloading_layer': 'device_01/offloading_layer',
35-
'device_input': 'device_01/input_data',
36-
'device_inference_result': 'device_01/model_inference_result'
32+
"registration": "devices/",
33+
"offloading_layer": "device_01/offloading_layer",
34+
"device_input": "device_01/input_data",
35+
"device_inference_result": "device_01/model_inference_result",
3736
}
38-
ntp_server = '0.it.pool.ntp.org'
37+
ntp_server = "0.it.pool.ntp.org"
3938
input_height = 96
4039
input_width = 96
4140
last_offloading_layer = 58
@@ -49,22 +48,22 @@ def mqtt_client_fixture(offloading_data_fixture):
4948
input_height=input_height,
5049
input_width=input_width,
5150
last_offloading_layer=last_offloading_layer,
52-
request_handler=RequestHandler()
51+
request_handler=RequestHandler(),
5352
)
5453

5554

5655
@pytest.fixture
5756
def device_fixture(mqtt_client_fixture):
58-
broker_url = 'hostname.local'
57+
broker_url = "hostname.local"
5958
broker_port = 1883
60-
client_id = 'edge'
59+
client_id = "edge"
6160
topics = {
62-
'registration': 'devices/',
63-
'offloading_layer': 'device_01/offloading_layer',
64-
'device_input': 'device_01/input_data',
65-
'device_inference_result': 'device_01/model_inference_result'
61+
"registration": "devices/",
62+
"offloading_layer": "device_01/offloading_layer",
63+
"device_input": "device_01/input_data",
64+
"device_inference_result": "device_01/model_inference_result",
6665
}
67-
ntp_server = '0.it.pool.ntp.org'
66+
ntp_server = "0.it.pool.ntp.org"
6867
input_height = 96
6968
input_width = 96
7069
last_offloading_layer = 58
@@ -78,5 +77,5 @@ def device_fixture(mqtt_client_fixture):
7877
input_height=input_height,
7978
input_width=input_width,
8079
last_offloading_layer=last_offloading_layer,
81-
request_handler=RequestHandler()
80+
request_handler=RequestHandler(),
8281
)

tests/test_edge/test_edge.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,24 @@
11
from server.edge.edge_initialization import Edge
22

3+
34
def test_edge():
45
e = Edge()
56
height = 96
67
width = 96
7-
e.initialization(input_height=height, input_width=width)
8+
model_dir = "test_model_96x96"
9+
model_key = "fomo_96x96"
10+
models_config = {
11+
"fomo_96x96": {
12+
"input_height": 96,
13+
"input_width": 96,
14+
"last_offloading_layer": 58,
15+
"model_dir": "test_model_96x96",
16+
}
17+
}
18+
e.initialization(
19+
input_height=height,
20+
input_width=width,
21+
model_dir=model_dir,
22+
model_key=model_key,
23+
models_config=models_config,
24+
)

0 commit comments

Comments
 (0)