Skip to content

Add a first batch of non regression tests#164

Open
mruiz-ledger wants to merge 5 commits intodevelopfrom
tests
Open

Add a first batch of non regression tests#164
mruiz-ledger wants to merge 5 commits intodevelopfrom
tests

Conversation

@mruiz-ledger
Copy link
Copy Markdown
Contributor

No description provided.

@mruiz-ledger mruiz-ledger force-pushed the tests branch 2 times, most recently from 2e1cd5f to 7e40060 Compare May 6, 2026 12:33
mruiz-ledger and others added 4 commits May 6, 2026 14:39
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Run UPDATE_SNAPSHOTS=1 pytest to regenerate fixtures after an
intentional APDU change.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds an initial suite of non-regression tests for ledgerblue, including snapshot (“golden”) APDU comparisons for loadApp offline mode, plus CI wiring to run pytest (with coverage) across supported Python versions.

Changes:

  • Add pytest-based unit/integration tests for hexParser, hexLoader, and loadApp (offline/APDU snapshot testing).
  • Add shared test fixtures that download a known app-boilerplate ELF release and convert it to Intel HEX (cached under tests/.cache).
  • Enable pytest + coverage in pyproject.toml and run tests in GitHub Actions CI.

Reviewed changes

Copilot reviewed 23 out of 27 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/test_smoke.py Adds a minimal smoke test verifying the package imports and exposes a version string.
tests/test_load_app.py Adds offline loadApp snapshot tests and smoke coverage for several CLI argument combinations.
tests/test_hex_parser.py Adds unit tests for Intel HEX parsing/printing helpers and round-trip behavior.
tests/test_hex_loader.py Adds APDU-level tests for HexLoader, including secure wrap/unwrap round-trips.
tests/fixtures/ref_signature.apdu Adds/updates a golden APDU reference for signature handling.
tests/fixtures/ref_nocrc.apdu Adds/updates a golden APDU reference for --nocrc.
tests/fixtures/ref_installparams_size.apdu Adds/updates a golden APDU reference for install params sizing.
tests/conftest.py Introduces session fixtures that fetch and cache boilerplate ELF→HEX test inputs.
README.md Documents how to run tests and how to update golden APDU snapshots.
pyproject.toml Adds dev test dependencies + pytest/coverage configuration defaults.
.gitignore Ignores coverage output and the tests cache directory.
.github/workflows/ci.yml Updates CI to install dev extras and run pytest across multiple Python versions.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread README.md
Comment on lines +85 to +87
Run the test suite with:

```bash
Comment thread README.md
Comment on lines +99 to +102
```

The updated `tests/fixtures/minimal_reference.apdu` should then be committed alongside the code change so the diff in the reference file documents exactly what changed at the wire level.

Comment thread tests/test_hex_parser.py
out = tmp_path / "out.hex"
printer.writeTo(str(out))
content = out.read_text()
assert "030000" in content.lower() or content.startswith(":")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants