From 50768a1c0a380c7a41792ce7e344190ce6cc7f24 Mon Sep 17 00:00:00 2001 From: Fu Hanxi Date: Wed, 13 Nov 2024 15:16:25 +0100 Subject: [PATCH 1/2] fix(nuttx): optional dependency esptool --- pytest-embedded-nuttx/pytest_embedded_nuttx/__init__.py | 1 - pytest-embedded-nuttx/pytest_embedded_nuttx/dut.py | 7 ++++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pytest-embedded-nuttx/pytest_embedded_nuttx/__init__.py b/pytest-embedded-nuttx/pytest_embedded_nuttx/__init__.py index 87d7ea02..a0a975c3 100644 --- a/pytest-embedded-nuttx/pytest_embedded_nuttx/__init__.py +++ b/pytest-embedded-nuttx/pytest_embedded_nuttx/__init__.py @@ -4,7 +4,6 @@ from pytest_embedded.utils import lazy_load -from .app import NuttxApp from .dut import NuttxDut, NuttxEspDut __getattr__ = lazy_load( diff --git a/pytest-embedded-nuttx/pytest_embedded_nuttx/dut.py b/pytest-embedded-nuttx/pytest_embedded_nuttx/dut.py index 51a2820b..fd99f00e 100644 --- a/pytest-embedded-nuttx/pytest_embedded_nuttx/dut.py +++ b/pytest-embedded-nuttx/pytest_embedded_nuttx/dut.py @@ -1,12 +1,13 @@ import logging import re from time import sleep -from typing import AnyStr +from typing import TYPE_CHECKING, AnyStr import pexpect from pytest_embedded_serial.dut import SerialDut -from .app import NuttxApp +if TYPE_CHECKING: + from .app import NuttxApp class NuttxDut(SerialDut): @@ -83,7 +84,7 @@ class NuttxEspDut(NuttxDut): def __init__( self, - app: NuttxApp, + app: 'NuttxApp', **kwargs, ) -> None: self.target = app.target From fe7f800fc71a311eaece370896a9eceb1a75f32b Mon Sep 17 00:00:00 2001 From: Fu Hanxi Date: Wed, 13 Nov 2024 15:25:44 +0100 Subject: [PATCH 2/2] chore(nuttx): modify readme file --- pytest-embedded-nuttx/README.md | 18 +++++++----------- pytest-embedded/pytest_embedded/plugin.py | 1 + 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/pytest-embedded-nuttx/README.md b/pytest-embedded-nuttx/README.md index 3902d6e4..57c94453 100644 --- a/pytest-embedded-nuttx/README.md +++ b/pytest-embedded-nuttx/README.md @@ -1,17 +1,13 @@ ### pytest-embedded-nuttx -Pytest embedded service for NuttX project. alongside Espressif devices. +Pytest embedded service for the NuttX project, compatible with Espressif devices. -Using the 'nuttx' service alongside 'serial' allows writing and reading from -the serial port, taking the NuttShell into consideration when running programs -and even getting return codes. +Using the 'nuttx' service alongside 'serial' enables reading from and writing to the serial port, taking NuttShell into account when running programs and retrieving return codes. -While using pytest-embedded-nuttx allows you to communicate with serial -devices and run simple tests, enabling the 'esp' service adds extra capabilities for -Espressif devices, such as flashing and device rebooting. +The `nuttx` service provides basic serial communication and testing. Adding the 'esp' service enables further capabilities for Espressif devices, including flashing and device rebooting. -Extra Functionalities: +Additional Features: -- `app`: Explore the NuttX binary directory and identify firmware and bootloader files. -- `serial`: Parse the binary information and flash the board. Requires 'esp' service. -- `dut`: Send commands to device through serial port. Requires 'serial' service or 'esp' for Espressif devices. +- `app`: Scans the NuttX binary directory to locate firmware and bootloader files. +- `serial`: Parses binary information and flashes the board. Requires the 'esp' service. +- `dut`: Sends commands to the device through the serial port. Requires the 'serial' service or 'esp' service for Espressif devices. diff --git a/pytest-embedded/pytest_embedded/plugin.py b/pytest-embedded/pytest_embedded/plugin.py index 8c7aab5e..d5311677 100644 --- a/pytest-embedded/pytest_embedded/plugin.py +++ b/pytest-embedded/pytest_embedded/plugin.py @@ -129,6 +129,7 @@ def pytest_addoption(parser): '- qemu: use qemu simulator instead of the real target\n' '- arduino: auto-detect more app info with arduino specific rules, auto flash-in\n' '- wokwi: use wokwi simulator instead of the real target\n' + '- nuttx: service for nuttx project, optionally with espressif devices\n' 'All the related CLI options are under the groups named by "embedded-"', ) base_group.addoption('--app-path', help='App path')