Skip to content

Commit a994e0d

Browse files
committed
[WIP] Update test to skip if no hardware was found
Still missing proper verification
1 parent fac803f commit a994e0d

1 file changed

Lines changed: 18 additions & 13 deletions

File tree

tests/test_dynapcnn/test_dvs_input.py

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -329,10 +329,16 @@ def test_whether_dvs_mirror_cfg_is_all_switched_off(dvs_input, pool):
329329

330330
def test_record_dvs_input():
331331
from torch import nn
332+
from hw_utils import find_open_devices
332333

333334
from sinabs.backend.dynapcnn import DynapcnnNetwork
334335
from sinabs.backend.dynapcnn.chip_factory import ChipFactory
335336

337+
devices = find_open_devices()
338+
339+
if len(devices) == 0:
340+
pytest.skip("A connected Speck device is required to run this test")
341+
336342
shape = (128, 128)
337343
layers = [
338344
DVSLayer(
@@ -343,22 +349,21 @@ def test_record_dvs_input():
343349

344350
dynapcnn = DynapcnnNetwork(snn=snn, dvs_input=True, discretize=True)
345351

346-
# Deploy model to a dev-kit
347-
dynapcnn.to(device="speck2fdevkit:0", monitor_layers=["dvs"])
352+
# Deploy model to a devkit
348353

349-
factory = ChipFactory("speck2fdevkit")
354+
for device_name, _ in devices.items():
355+
dynapcnn.to(device=device_name, monitor_layers=["dvs"])
350356

351-
Spike = factory.get_config_builder().get_samna_module().event.Spike
357+
factory = ChipFactory(device_name)
352358

353-
input_data = [
354-
Spike(timestamp=10),
355-
]
359+
Spike = factory.get_config_builder().get_samna_module().event.Spike
356360

357-
print(input_data)
358-
events_out = dynapcnn(input_data)
359-
360-
# print(events_out)
361+
input_data = [
362+
Spike(timestamp=10),
363+
]
361364

362-
print(len(events_out))
365+
events_out = dynapcnn(input_data)
363366

364-
assert False
367+
# TODO: add a proper verification for this test
368+
# print(events_out)
369+
# print(len(events_out))

0 commit comments

Comments
 (0)