Skip to content

Add dedicated unit tests workflow - #162

Merged
mkoura merged 3 commits into
mainfrom
ci/add-unit-tests-workflow
Jul 31, 2026
Merged

Add dedicated unit tests workflow#162
mkoura merged 3 commits into
mainfrom
ci/add-unit-tests-workflow

Conversation

@OlufemiAdeOlusile

Copy link
Copy Markdown
Contributor

Summary

The fast, unmarked pytest tests (log parsing, graph generation, start_node, request retry, disk cleanup) never ran in CI:

  • repo_lint.yaml only lints (pre-commit), no pytest at all
  • node_sync_test.yaml only runs test_nodesync_artifacts.py specifically
  • db_sync_full_sync.yaml filters by marker (node_sync or db_sync), excluding anything unmarked
  • nix_smoke.yaml only triggers on Nix file changes and just does an import check

Added unit_tests.yaml: runs on every PR to main, plain ubuntu-latest (no self-hosted runner needed since these are pure Python tests with no live node/db-sync involved), installs the package via pip, then runs pytest with everything marked node_sync, db_sync, snapshot_creation, local_snapshot, iohk_snapshot, or mainnet_tx_count excluded, leaving just the fast unmarked tests.

Test plan

Comment thread .github/workflows/unit_tests.yaml Fixed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds a new GitHub Actions workflow to ensure the repo’s fast, unmarked Python pytest tests run in CI on every PR targeting main, while continuing to exclude the slower/live-sync test suites via marker filtering.

Changes:

  • Introduces a dedicated unit_tests workflow that runs on pull_request to main.
  • Sets up Python 3.11 on ubuntu-latest, installs the package, and runs pytest with marker-based exclusions to target only the fast unmarked tests.

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

The fast, unmarked pytest tests (log parsing, graph generation,
start_node, request retry, disk cleanup) never ran in CI. repo_lint.yaml
only lints; node_sync_test.yaml and db_sync_full_sync.yaml only run the
marked live-sync tests; nix_smoke.yaml only triggers on Nix file
changes and just does an import check.

Added unit_tests.yaml: runs on every PR to main, plain ubuntu-latest,
pip install -e . then pytest with everything marked node_sync,
db_sync, snapshot_creation, local_snapshot, iohk_snapshot, or
mainnet_tx_count excluded, leaving just the fast unmarked tests.
CodeQL flagged the job for not limiting GITHUB_TOKEN permissions.
This workflow only checks out the repo and runs pytest, so
contents: read is all it needs.
Framework tests moved to a top-level framework_tests/ directory
in #165. This workflow still targeted sync_tests/tests/ with a
marker-exclusion filter, which after that move would just select
zero tests, silently.

Now runs pytest framework_tests directly, no filter needed, same
as how cardano-node-tests invokes its equivalent in
code_checks.yaml.

Verified by simulating the exact CI steps in a fresh venv: fresh
install via pip install -e ., then pytest framework_tests -v,
20 passed.
@OlufemiAdeOlusile
OlufemiAdeOlusile force-pushed the ci/add-unit-tests-workflow branch from 52cfd5d to 769bd91 Compare July 30, 2026 10:29
@mkoura
mkoura merged commit fac8066 into main Jul 31, 2026
5 checks passed
@mkoura
mkoura deleted the ci/add-unit-tests-workflow branch July 31, 2026 11:01
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.

4 participants