Skip to content

Add support for module tests#39

Open
xsedla1o wants to merge 8 commits into
masterfrom
module-tests
Open

Add support for module tests#39
xsedla1o wants to merge 8 commits into
masterfrom
module-tests

Conversation

@xsedla1o
Copy link
Copy Markdown
Collaborator

Adds lightweight testing utilities for DP3 secondary modules so app developers can unit-test module hook behavior without running a full DP3 instance.

Secondary modules were difficult to test because they normally depend on DP3 runtime wiring. This branch provides a unittest-friendly harness that loads real app entity config, captures hook registrations, and lets tests invoke hooks directly with validated DP3 task/datapoint objects.

Examples

To showcase potential usefulness of such helpers, usable test suites were drafted for select internal apps:

  • ADiCT
  • Amfora (tests pass when this branch of DP3 is installed, CI fails as installs from main)
  • NERD2

Changes

  • Added dp3.testing helpers, centered around DP3ModuleTestCase.
  • Added fake/capturing callback registrar for module hook registration tests.
  • Added helpers for building tasks/datapoints, running hooks, scheduler callbacks, updater hooks, and snapshot/correlation
    hooks.
  • Added assertion helpers for emitted tasks/datapoints and mutated snapshot records.
  • Added timeseries datapoint test helper.
  • Documented module testing workflow in docs.
  • Added tests covering the new utilities.
  • Added validation preventing empty DataPointTasks that would do no work, while preserving internal synthetic-task use cases.

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