From 46e7e9e612122c065d1a879228716b0c34188646 Mon Sep 17 00:00:00 2001 From: Fu Hanxi Date: Wed, 17 Jun 2026 11:20:29 +0200 Subject: [PATCH 1/2] chore: small fixes --- .github/workflows/publish_pypi.yml | 2 +- .github/workflows/report.yml | 2 +- .github/workflows/sync-jira.yml | 2 +- .github/workflows/test-build-docs.yml | 2 +- .github/workflows/test-build-package.yml | 2 +- .github/workflows/test-python.yml | 4 ++-- .pre-commit-config.yaml | 2 +- pytest-embedded/pytest_embedded/plugin.py | 12 ++++++++---- 8 files changed, 16 insertions(+), 12 deletions(-) diff --git a/.github/workflows/publish_pypi.yml b/.github/workflows/publish_pypi.yml index dc5569c6..c04a779d 100644 --- a/.github/workflows/publish_pypi.yml +++ b/.github/workflows/publish_pypi.yml @@ -9,7 +9,7 @@ jobs: deploy: runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@v7 - name: Set up Python uses: actions/setup-python@v6 with: diff --git a/.github/workflows/report.yml b/.github/workflows/report.yml index c54f84d9..d954dc06 100644 --- a/.github/workflows/report.yml +++ b/.github/workflows/report.yml @@ -16,7 +16,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Download test results - uses: dawidd6/action-download-artifact@v18 + uses: dawidd6/action-download-artifact@v21 with: workflow: ${{ github.event.workflow_run.workflow_id }} run_id: ${{ github.event.workflow_run.id }} diff --git a/.github/workflows/sync-jira.yml b/.github/workflows/sync-jira.yml index 4bfd5a3d..d80f605a 100644 --- a/.github/workflows/sync-jira.yml +++ b/.github/workflows/sync-jira.yml @@ -46,7 +46,7 @@ jobs: pull-requests: write steps: - name: Check out - uses: actions/checkout@v6 + uses: actions/checkout@v7 - name: Run synchronization to Jira uses: espressif/sync-jira-actions@v1 diff --git a/.github/workflows/test-build-docs.yml b/.github/workflows/test-build-docs.yml index 6e2630bf..7be52327 100644 --- a/.github/workflows/test-build-docs.yml +++ b/.github/workflows/test-build-docs.yml @@ -11,7 +11,7 @@ jobs: test-build-docs: runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@v7 - name: Set up Python uses: actions/setup-python@v6 with: diff --git a/.github/workflows/test-build-package.yml b/.github/workflows/test-build-package.yml index 0c2058ca..3f74ba92 100644 --- a/.github/workflows/test-build-package.yml +++ b/.github/workflows/test-build-package.yml @@ -7,7 +7,7 @@ jobs: test-build-packages: runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@v7 - name: Set up Python uses: actions/setup-python@v6 with: diff --git a/.github/workflows/test-python.yml b/.github/workflows/test-python.yml index 5653c4af..cb2cccbb 100644 --- a/.github/workflows/test-python.yml +++ b/.github/workflows/test-python.yml @@ -21,7 +21,7 @@ jobs: timeout-minutes: 40 runs-on: ubuntu-latest steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@v7 - uses: actions/setup-python@v6 with: python-version: "3.14" @@ -86,7 +86,7 @@ jobs: image: python:${{ matrix.python-version }} options: --privileged steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@v7 - name: Install dependencies run: | apt update && apt install -y socat zip diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 58432e28..cd2c41e0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -15,7 +15,7 @@ repos: - id: mixed-line-ending args: ["-f=lf"] - repo: https://github.com/astral-sh/ruff-pre-commit - rev: "v0.15.6" + rev: "v0.15.20" hooks: - id: ruff-check args: ["--fix"] diff --git a/pytest-embedded/pytest_embedded/plugin.py b/pytest-embedded/pytest_embedded/plugin.py index 1ba38f41..2984d9fa 100644 --- a/pytest-embedded/pytest_embedded/plugin.py +++ b/pytest-embedded/pytest_embedded/plugin.py @@ -70,7 +70,7 @@ _T = t.TypeVar('_T') -def pytest_addoption(parser): +def pytest_addoption(parser: pytest.Parser): base_group = parser.getgroup('embedded') base_group.addoption( '--count', @@ -1415,7 +1415,7 @@ def pytest_collection_modifyitems(self, config: Config, items: list[Function]): from esp_bool_parser import parse_bool_expr - target = config.getoption('--target', None) + target = config.getoption('target', None) if hasattr(item, 'callspec'): target = item.callspec.params.get('target', None) if target == 'auto' or not isinstance(target, str): @@ -1491,7 +1491,7 @@ def pytest_runtest_call(self, item: Function): self._raise_dut_failed_cases_if_exists(all_duts) # type: ignore @pytest.hookimpl(trylast=True) # combine all possible junit reports should be the last step - def pytest_sessionfinish(self, session: Session, exitstatus: int) -> None: + def pytest_sessionfinish(self, session: Session) -> None: modifier: JunitMerger = session.config.stash[_junit_merger_key] _stash_session_tempdir = session.config.stash.get(_session_tempdir_key, None) _stash_junit_report_path = session.config.stash.get(_junit_report_path_key, None) @@ -1509,4 +1509,8 @@ def pytest_sessionfinish(self, session: Session, exitstatus: int) -> None: if self.prettify_junit_report: _prettify_xml(_stash_junit_report_path) - exitstatus = int(modifier.failed) # True -> 1 False -> 0 # noqa + # escalate the session exit status to failure if the merged junit report contains failures, + # without downgrading an already-failing run + current_exitstatus = getattr(session, 'exitstatus', pytest.ExitCode.OK) + if modifier.failed and current_exitstatus == pytest.ExitCode.OK: + session.exitstatus = pytest.ExitCode.TESTS_FAILED From 4f4d71373aa88947efe16e14e69f32f831078fc8 Mon Sep 17 00:00:00 2001 From: Fu Hanxi Date: Mon, 29 Jun 2026 10:56:01 +0200 Subject: [PATCH 2/2] fix: arduino app check both .ino.merged.bin and .ino.bin --- pytest-embedded-arduino/pytest_embedded_arduino/app.py | 7 +++++-- pytest-embedded-arduino/tests/test_arduino.py | 5 ++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/pytest-embedded-arduino/pytest_embedded_arduino/app.py b/pytest-embedded-arduino/pytest_embedded_arduino/app.py index 025e654e..bb75748d 100644 --- a/pytest-embedded-arduino/pytest_embedded_arduino/app.py +++ b/pytest-embedded-arduino/pytest_embedded_arduino/app.py @@ -19,7 +19,8 @@ class ArduinoApp(App): flash_settings (dict[str, str]): Flash settings for the target. flash_files (list[tuple[str, str]]): ``(address, filepath)`` pairs parsed from ``flash_args``. Each filepath is absolute. - binary_file (str): Merged binary file path. + binary_file (str): Application binary file path (``.ino.merged.bin`` if present, + otherwise ``.ino.bin``). elf_file (str): ELF file path. """ @@ -35,7 +36,9 @@ def __init__( self.fqbn = self._get_fqbn(self.binary_path) self.target = self.fqbn.split(':')[2] self.flash_settings, self.flash_files = self._parse_flash_args() - self.binary_file = os.path.realpath(os.path.join(self.binary_path, self.sketch + '.ino.merged.bin')) + merged_bin = os.path.realpath(os.path.join(self.binary_path, self.sketch + '.ino.merged.bin')) + ino_bin = os.path.realpath(os.path.join(self.binary_path, self.sketch + '.ino.bin')) + self.binary_file = merged_bin if os.path.exists(merged_bin) else ino_bin self.elf_file = os.path.realpath(os.path.join(self.binary_path, self.sketch + '.ino.elf')) logging.debug(f'Build path: {self.binary_path}') diff --git a/pytest-embedded-arduino/tests/test_arduino.py b/pytest-embedded-arduino/tests/test_arduino.py index 8b4c3bbd..6bac6873 100644 --- a/pytest-embedded-arduino/tests/test_arduino.py +++ b/pytest-embedded-arduino/tests/test_arduino.py @@ -2,7 +2,10 @@ def test_arduino_serial_flash(testdir): - bin_path = os.path.join(testdir.tmpdir, 'hello_world_arduino', 'build', 'hello_world_arduino.ino.merged.bin') + build_dir = os.path.join(testdir.tmpdir, 'hello_world_arduino', 'build') + merged_bin = os.path.join(build_dir, 'hello_world_arduino.ino.merged.bin') + ino_bin = os.path.join(build_dir, 'hello_world_arduino.ino.bin') + bin_path = merged_bin if os.path.exists(merged_bin) else ino_bin testdir.makepyfile(f""" import pexpect