diff --git a/pytest-embedded-espemu/pytest_embedded_espemu/dut.py b/pytest-embedded-espemu/pytest_embedded_espemu/dut.py index 3c68dd2c..7ba0e3e1 100644 --- a/pytest-embedded-espemu/pytest_embedded_espemu/dut.py +++ b/pytest-embedded-espemu/pytest_embedded_espemu/dut.py @@ -8,6 +8,9 @@ class EspEmuDut(Dut): """ esp-emu dut class + + Attributes: + target (str): target chip type, taken from the app """ def __init__( @@ -19,6 +22,11 @@ def __init__( super().__init__(**kwargs) + # `IdfDut` exposes this for serial runs, and test fixtures use it to + # select target specific behavior. `EspEmuApp` is an `IdfApp`, so the + # target is known here as well; keep it optional for other app classes. + self.target: str | None = getattr(self.app, 'target', None) + self._hard_reset_func = self.espemu._hard_reset def write(self, s: AnyStr) -> None: diff --git a/pytest-embedded-qemu/pytest_embedded_qemu/dut.py b/pytest-embedded-qemu/pytest_embedded_qemu/dut.py index a3ac3444..e4af8e4b 100644 --- a/pytest-embedded-qemu/pytest_embedded_qemu/dut.py +++ b/pytest-embedded-qemu/pytest_embedded_qemu/dut.py @@ -8,6 +8,9 @@ class QemuDut(Dut): """ QEMU dut class + + Attributes: + target (str): target chip type, taken from the app """ def __init__( @@ -19,6 +22,11 @@ def __init__( super().__init__(**kwargs) + # `IdfDut` exposes this for serial runs, and test fixtures use it to + # select target specific behavior. `QemuApp` is an `IdfApp`, so the + # target is known here as well; keep it optional for other app classes. + self.target: str | None = getattr(self.app, 'target', None) + self._hard_reset_func = self.qemu._hard_reset def write(self, s: AnyStr) -> None: