Skip to content

Improved standardised testing suite - #86

Open
irm-codebase wants to merge 2 commits into
mainfrom
feature/convention-testing-upgrade
Open

irm-codebase wants to merge 2 commits into
mainfrom
feature/convention-testing-upgrade

Conversation

@irm-codebase

@irm-codebase irm-codebase commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

Fixes #85

Separates standard Modelblocks checks from module unit tests and sunsets the old test/integration_test.py file in favour of more targeted test separation.

  • Moves compatibility and integration tests to tests/modelblocks/, which is now fully managed by the template.
    • convention_test.py: validates that files and behaviour specified in the Modelblocks convention.
    • module_integration_test.py: tests emulating importing the module into another workflow live here.
  • Adds tests/unit/, coupled with a new pixi run test-unit task. It lets you run unit tests on workflow/scripts/*.py code.
    • new environment (unit-test) which extends the module environment, resolved in tandem with it.
    • A new CI task running these unit tests was added to .github/workflows/pr-ci.yml. It will fail by default (to force people to add at least a couple of unit tests).
    • Test code is generally shielded from template updates (only conftest.py is seen by the template, which is quite minimal).
  • Additional updates to CI, documentation, and copier rules related to these changes.
  • Added a short migration guidance that will show up after users run copier update.

If this is accepted, I'll submit a sister PR to the docs specifying the new testing method.

@irm-codebase

Copy link
Copy Markdown
Member Author

At long last, here is the first item from the workshop!
Took a couple of iterations. I tried my best to keep the template lean.

I'd be interested in feedback from @ekatef, @fneum, @davide-f, or @lkstrp, of course!

@jnnr jnnr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for this, @irm-codebase! I left some minor comments.
I think that more guidelines for developers should be added to the README; on where to place additional tests (tests/unit, tests/integration (?)), what they can alter (tests/unit/, tests/modelblocks/integration/module_integration_test.py) and where to leave their hands off (tests/modelblocks/convention_test.py). There could be a convention test that enforces the latter.

Shall we add a directory tests/integration for more integration tests? Some modules already have some local performance tests, for example.

Comment thread template/README.md.jinja Resolved
- Removed check for figures/module.png
- Small docstring fix in the README.md of the generated module
@irm-codebase

Copy link
Copy Markdown
Member Author

@jnnr about the testing guidance, I agree.

I was thinking that maybe the following should be added:

  • Perhaps a third folder tests/workflow/ (or tests/local_workflow?) for "heavy" Snakemake testing (replacing the "tests/local_test.py` that some modules have). We can leave whether or not to include it in CI to the dev, but by default it should not be there.
  • A small readme in tests/README.md specifying what each test folder is for. It should be under the control of the template.

Does this sound like a good idea?

@irm-codebase
irm-codebase requested a review from jnnr November 6, 2026 11:06
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.

Separate tests into convention / integration / unit test folders

2 participants