Skip to content

Commit

Permalink
Documentation about testing (#137)
Browse files Browse the repository at this point in the history
* [BUG] inside unit_tests workflow

* [DOC] fix some broken links

* [DOC] adding template for pipeline testing

* [DOC] adding template for pipeline testing

* About implemented_pipelines

* Deal with test template

* [DOC] new readme for the doc

* Changes in README.md

* [DOC] slight changes to docs/README.md

* Add links to past events

* Changes in readme.md

* fMRI trail

* Adding trail description in contribution guide

* Separate trails in contribution guide

* [TEST] Solving pytest issues with template test

* Changing docker image in use

* FSL template correction

* [DOC] writing test files

* Codespell
  • Loading branch information
bclenet authored Jan 10, 2024
1 parent d13e25f commit 670e2df
Show file tree
Hide file tree
Showing 4 changed files with 211 additions and 356 deletions.
10 changes: 5 additions & 5 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,18 @@ datalad get data/original/ds001734/derivatives/fmriprep/sub-00[1-4] -J 12
## 4 - Set up the environment

[Install Docker](https://docs.docker.com/engine/install/) then pull the Docker image :
[Install Docker](https://docs.docker.com/engine/install/) then pull the nipype Docker image :

```bash
docker pull elodiegermani/open_pipeline:latest
docker pull nipype/nipype
```

Once it's done you can check the image is available on your system :

```bash
docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/elodiegermani/open_pipeline latest 0f3c74d28406 9 months ago 22.7 GB
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/nipype/nipype latest 0f3c74d28406 9 months ago 22.7 GB
```

> [!NOTE]
Expand All @@ -63,7 +63,7 @@ Start a Docker container from the Docker image :

```bash
# Replace PATH_TO_THE_REPOSITORY in the following command (e.g.: with /home/user/dev/narps_open_pipelines/)
docker run -it -v PATH_TO_THE_REPOSITORY:/home/neuro/code/ elodiegermani/open_pipeline
docker run -it -v PATH_TO_THE_REPOSITORY:/home/neuro/code/ nipype/nipype
```

Install NARPS Open Pipelines inside the container :
Expand Down
10 changes: 5 additions & 5 deletions docs/environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

## The Docker container :whale:

The NARPS Open Pipelines project is build upon several dependencies, such as [Nipype](https://nipype.readthedocs.io/en/latest/) but also the original software packages used by the pipelines (SPM, FSL, AFNI...). Therefore, we created a Docker container based on [Neurodocker](https://github.com/ReproNim/neurodocker) that contains software dependencies.
The NARPS Open Pipelines project is build upon several dependencies, such as [Nipype](https://nipype.readthedocs.io/en/latest/) but also the original software packages used by the pipelines (SPM, FSL, AFNI...). Therefore we recommend to use the [`nipype/nipype` Docker image](https://hub.docker.com/r/nipype/nipype/) that contains all the required software dependencies.

The simplest way to start the container using the command below :
The simplest way to start the container is by using the command below :

```bash
docker run -it elodiegermani/open_pipeline
docker run -it nipype/nipype
```

From this command line, you need to add volumes to be able to link with your local files (code repository).
Expand All @@ -16,7 +16,7 @@ From this command line, you need to add volumes to be able to link with your loc
# Replace PATH_TO_THE_REPOSITORY in the following command (e.g.: with /home/user/dev/narps_open_pipelines/)
docker run -it \
-v PATH_TO_THE_REPOSITORY:/home/neuro/code/ \
elodiegermani/open_pipeline
nipype/nipype
```

## Use Jupyter with the container
Expand All @@ -27,7 +27,7 @@ If you wish to use [Jupyter](https://jupyter.org/) to run the code, a port forwa
docker run -it \
-v PATH_TO_THE_REPOSITORY:/home/neuro/code/ \
-p 8888:8888 \
elodiegermani/open_pipeline
nipype/nipype
```

Then, from inside the container :
Expand Down
11 changes: 10 additions & 1 deletion docs/pipelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,4 +149,13 @@ First have a look at the [testing page of the documentation](/docs/testing.md).
All tests must be contained in a single file named `tests/pipelines/test_team_<team_id>.py`. You can start by copy-pasting the template file : [tests/pipelines/templates/template_test.py](/tests/pipelines/templates/template_test.py) inside the `tests/pipelines/` directory, renaming it accordingly. Then, follow the instructions and tips inside the template and don't forget to replace `XXXX` with the actual team id, inside the document.

> [!NOTE]
> Feel free to have a look at [tests/pipelines/test_team_2T6S.py](/tests/pipelines/test_team_2T6S.py), which is the file containing all the automatic tests for the 2T6S pipeline : it gives an example.
> Feel free to have a look at [tests/pipelines/test_team_C88N.py](/tests/pipelines/test_team_C88N.py), which is the file containing all the automatic tests for the C88N pipeline : it gives an example.
Your test file must contain the following methods:
* one testing the execution of the pipeline and comparing the results with the original ones. This can be simply achieved with this line :
```python
helpers.test_pipeline_evaluation('C88N')
```
* one for each method you declared in the pipeline class (e.g.: testing the `get_subject_information` method)
* one testing the instantiation of your pipeline (see `test_create` in `test_team_C88N.py`)
* one testing the `get_*_outputs` methods of your pipeline (see `test_outputs` in `test_team_C88N.py`)
Loading

0 comments on commit 670e2df

Please sign in to comment.