Skip to content

test: Introduce isolated package-level unit testing architecture#46

Open
aviralsaxena16 wants to merge 7 commits intoOSIPI:mainfrom
aviralsaxena16:feat/package-level-unit-tests
Open

test: Introduce isolated package-level unit testing architecture#46
aviralsaxena16 wants to merge 7 commits intoOSIPI:mainfrom
aviralsaxena16:feat/package-level-unit-tests

Conversation

@aviralsaxena16
Copy link

Resolves #45

Context

This PR represents Phase 4 of the structured testing roadmap:

#21 - Phase 1: CI pipeline foundation
#22 - Phase 2: End-to-end backend regression fixtures
#33 - Phase 3: Coverage visibility in CI
This PR - Phase 4: Isolated package-level unit testing

Note: This branch is stacked on top of #21, #22, and #33. The diff currently includes cumulative changes and will reduce once earlier PRs are merged.

Motivation

While Phases 1–3 secured the FastAPI integration layer through deterministic regression testing and coverage reporting, the core pyaslreport package was still being exercised as a black box.

This created three architectural limitations:

  • Internal logic failures were harder to isolate
  • CI feedback relied entirely on heavier integration fixtures
  • There was no scalable structure for testing internal modules independently

As we prepare for DCE/DSC expansion and increased architectural complexity, fast and isolated unit validation becomes essential.

What This PR Introduces

Package-Level Test Architecture

New directory structure: package/tests/unit/

Deterministic Unit Tests for Core Components

Initial coverage targets:

  • UnitConverterUtils
  • ModalityTypeValues
  • MODALITY_REGISTRY
  • Config loader logic

These tests:

  • Are dependency-free
  • Run in <1 second
  • Do not require DICOM or NIfTI fixtures
  • Provide granular validation of internal utilities
Screenshot 2026-03-03 174451

Layered CI Execution

The CI workflow is now structured into two stages:

  1. Fast package unit tests
  2. Backend integration regression tests (run only if unit tests pass)

This improves:

  • Contributor feedback speed
  • Failure isolation
  • Long-term scalability of the testing matrix

Architectural Impact

This PR formally separates:

  • Package-level logic validation
  • Backend-level integration validation

The result:

  • Internal changes are validated immediately
  • CI runtime remains manageable as modality support grows
  • New module-level tests can be added incrementally

This directly supports the GSoC objective of preparing a structure
“so that further testing files for all modules can be easily uploaded.”

Additional Fix Identified During Phase 4

While setting up isolated tests, a broken internal import in enums/__init__.py was discovered and corrected.

This reinforces the value of separating package-level validation from integration tests.

Forward Direction

With this structure in place, we can now:

  • Add focused tests for sequence factory logic
  • Extend modality registry safely for DCE/DSC
  • Introduce coverage thresholds per layer
  • Scale CI without increasing feedback latency

Best,
Aviral

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.

[Testing] Introduce Isolated Package-Level Unit Test Architecture

1 participant