mirror of
https://github.com/MillironX/nf-core_modules.git
synced 2024-12-22 11:08:17 +00:00
Add docs for running tests locally with pytest (#338)
* Add docs for running tests locally with pytest * Add docs for tag
This commit is contained in:
parent
3d720a24fd
commit
246011f59b
1 changed files with 40 additions and 0 deletions
40
README.md
40
README.md
|
@ -23,6 +23,7 @@ A repository for hosting [Nextflow DSL2](https://www.nextflow.io/docs/latest/dsl
|
|||
- [Checklist](#checklist)
|
||||
- [nf-core modules create](#nf-core-modules-create)
|
||||
- [Test data](#test-data)
|
||||
- [Running tests manually](#running-tests-manually)
|
||||
- [Uploading to `nf-core/modules`](#uploading-to-nf-coremodules)
|
||||
- [Guidelines](#guidelines)
|
||||
- [Terminology](#terminology)
|
||||
|
@ -248,6 +249,8 @@ We have implemented a number of commands in the `nf-core/tools` package to make
|
|||
INFO Writing to 'tests/software/fastqc/test.yml' test_yml_builder.py:293
|
||||
```
|
||||
|
||||
> NB: See docs for [running tests manually](#running-tests-manually) if you would like to run the tests manually.
|
||||
|
||||
7. Lint the module locally to check that it adheres to nf-core guidelines before submission
|
||||
|
||||
```console
|
||||
|
@ -301,6 +304,43 @@ In order to test that each module added to `nf-core/modules` is actually working
|
|||
|
||||
- Test files MUST be kept as tiny as possible.
|
||||
|
||||
### Running tests manually
|
||||
|
||||
As outlined in the [nf-core modules create](#nf-core-modules-create) section we have made it quite trivial to create an initial yaml file (via the `nf-core modules create-test-yml` command) containing a listing of all of the module output files and their associated md5sums. However, md5sum checks may not be appropriate for all output files if for example they contain timestamps. This is why it is a good idea to re-run the tests locally with `pytest-workflow` before you create your pull request adding the module. If your files do indeed have timestamps or other issues that prevent you from using the md5sum check, then you can edit the `test.yml` file to instead check that the file contains some specific content or as a last resort, if it exists. The different test options are listed in the [pytest-workflow docs](https://pytest-workflow.readthedocs.io/en/stable/#test-options).
|
||||
|
||||
Please follow the steps below to run the tests locally:
|
||||
|
||||
1. Install [`nextflow`](https://nf-co.re/usage/installation)
|
||||
|
||||
2. Install any of [`Docker`](https://docs.docker.com/engine/installation/), [`Singularity`](https://www.sylabs.io/guides/3.0/user-guide/) or [`Conda`](https://conda.io/miniconda.html)
|
||||
|
||||
3. Install [`pytest-workflow`](https://pytest-workflow.readthedocs.io/en/stable/#installation)
|
||||
|
||||
4. Start running your own tests using the appropriate [`tag`](https://github.com/nf-core/modules/blob/3d720a24fd3c766ba56edf3d4e108a1c45d353b2/tests/software/fastqc/test.yml#L3-L5) defined in the `test.yml`:
|
||||
|
||||
- Typical command with Docker:
|
||||
|
||||
```console
|
||||
cd /path/to/git/clone/of/nf-core/modules/
|
||||
PROFILE=docker pytest --tag fastqc_single_end --symlink --keep-workflow-wd
|
||||
```
|
||||
|
||||
- Typical command with Singularity:
|
||||
|
||||
```console
|
||||
cd /path/to/git/clone/of/nf-core/modules/
|
||||
TMPDIR=~ PROFILE=singularity pytest --tag fastqc_single_end --symlink --keep-workflow-wd
|
||||
```
|
||||
|
||||
- Typical command with Conda:
|
||||
|
||||
```console
|
||||
cd /path/to/git/clone/of/nf-core/modules/
|
||||
PROFILE=conda pytest --tag fastqc_single_end --symlink --keep-workflow-wd
|
||||
```
|
||||
|
||||
- See [docs on running pytest-workflow](https://pytest-workflow.readthedocs.io/en/stable/#running-pytest-workflow) for more info.
|
||||
|
||||
### Uploading to `nf-core/modules`
|
||||
|
||||
[Fork](https://help.github.com/articles/fork-a-repo/) the `nf-core/modules` repository to your own GitHub account. Within the local clone of your fork add the module file to the [`software/`](software) directory. Please try and keep PRs as atomic as possible to aid the reviewing process - ideally, one module addition/update per PR.
|
||||
|
|
Loading…
Reference in a new issue