From 0ba31e423cc2776b74c81d78822d0fca714360ee Mon Sep 17 00:00:00 2001 From: Ivan Ivanov Date: Wed, 7 Jun 2023 16:55:14 -0700 Subject: [PATCH] add testing documentation --- Contributing.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Contributing.md b/Contributing.md index 6c084b7f..2d840dbc 100644 --- a/Contributing.md +++ b/Contributing.md @@ -46,6 +46,25 @@ git config --global user.email your-address@example.com Make sure your fork stays up-to-date with the latest changes in the main repo by [syncing your fork](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork). +## Testing the code + +We use the [pytest](https://docs.pytest.org/) framework to test the code. During development, you can run the tests locally using + +```sh +# in the project root directory +pytest -v +``` + +The suite of [tests](https://github.com/micro-manager/pycro-manager/tree/main/pycromanager/test) also runs automatically using [GitHub Actions](https://github.com/micro-manager/pycro-manager/actions) for every PR. All tests must pass before a PR is merged. Please contribute new tests as you fix bugs and develop new features. + +Execution of the `pycro-manager` tests depends on [Micro-manager](https://micro-manager.org/) and several Java libraries ([AcqEngJ](https://github.com/micro-manager/AcqEngJ), [NDTiffStorage](https://github.com/micro-manager/NDTiffStorage), [NDViewer](https://github.com/micro-manager/NDViewer)). + +During setup, `pytest` will download the latest [nightly build](https://micro-manager.org/Micro-Manager_Nightly_Builds) of `Micro-manager` and install it in `~/Micro-Manager-nightly`; this step will be skipped if that folder exists. Currently installation of the latest `Micro-manager` nightly build through `pytest` is only supported on Windows platforms. For other platforms, please manually install a working version of `Micro-manager` in `~/Micro-Manager-nightly`. + +During setup, `pytest` will also look for pre-compiled `.jar` files in the `../../{java_lib_name}/target` directory (e.g. `../../{AcqEngJ}/target`) and replace the ones that are packaged with the `Micro-manager` nightly build if they are older version. This is helpful when co-developing these libraries. The user does need to pre-compile the Java libraries first. When the tests run in GitHub Actions they always use with the `.jar` files that are packaged with `Micro-manager`. + +Tests of the `pycro-manager` NDViewer and `napari` viewer only execute locally and are skipped by GitHub Actions. When making changes that may affect these viewer, please make sure to always run the tests locally. + ## Building the docs 1) Add/edit files in the `docs/source` directory