diff --git a/python_app/tests/test_cart_firmware.py b/python_app/tests/test_cart_firmware.py index 25f3af2..70fc807 100644 --- a/python_app/tests/test_cart_firmware.py +++ b/python_app/tests/test_cart_firmware.py @@ -7,6 +7,7 @@ import tempfile import unittest PROJECT = Path(__file__).resolve().parents[2] +FIRMWARE = PROJECT / 'device_firmware/cart_firmware/src/main.cpp' ARDUINO_STUB = r''' #pragma once @@ -46,14 +47,14 @@ inline void HAL_UART_Transmit(UART_HandleTypeDef*, uint8_t*, int, int) { ++trans @unittest.skipUnless(shutil.which('g++'), 'requires a host C++ compiler') +@unittest.skipUnless(FIRMWARE.is_file(), 'firmware sources are not deployed to hosts') class CartFirmwareTest(unittest.TestCase): def test_schedule_rollover_and_sbus_encoding(self) -> None: with tempfile.TemporaryDirectory() as directory: root = Path(directory) (root / 'Arduino.h').write_text(ARDUINO_STUB) source = root / 'check.cpp' - firmware = PROJECT / 'device_firmware/cart_firmware/src/main.cpp' - source.write_text(f'#include "{firmware}"\n' + r''' + source.write_text(f'#include "{FIRMWARE}"\n' + r''' #include int main() { test_time = UINT32_MAX - 100;