Skip to content

Commit

Permalink
Merge pull request #131 from EliLillyCo/release/1.4.0
Browse files Browse the repository at this point in the history
Release/1.4.0
  • Loading branch information
michaeltneylon authored Feb 26, 2020
2 parents e632dd1 + e348c08 commit bcc43ee
Show file tree
Hide file tree
Showing 27 changed files with 1,566 additions and 593 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ install:
- make install_development_requirements
- make install
before_script:
- wget https://github.com/broadinstitute/cromwell/releases/download/45/cromwell-45.jar -O /tmp/cromwell-45.jar
- export CROMWELL_JAR=/tmp/cromwell-45.jar
- wget https://github.com/broadinstitute/cromwell/releases/download/48/cromwell-48.jar -O /tmp/cromwell-48.jar
- export CROMWELL_JAR=/tmp/cromwell-48.jar
script:
- make test
- make test_release_setup
Expand Down
9 changes: 9 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changes

## v1.4.0 (2020.02.26)

* Added support for YAML data and configuration files (#116)
* Added a Cromwell Server executor (thanks @pamagee!)
* Added ability to specify tests in JSON/WDL (#117)
* Updated docs and testing to latest version of Cromwell (v48)
* Added an optional `callback` parameter to `workflow_runner`
* Fix miniwdl executor when there are no inputs (thanks @mlin!)

## v1.3.0 (2020.02.14)

* Added support for testing workflows on DNAnexus using [dxWDL](https://github.com/dnanexus/dxWDL)
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ tests = tests
# Use this option to show full stack trace for errors
#pytestopts = --full-trace
#pytestopts = -ra --tb=short
pytestopts = -s -vv --show-capture=all -m "not remote"
#pytestopts = -s -vv --show-capture=all -m "not integration"
pytestopts = -vv -m "not remote"
#pytestopts = -vv --show-capture=all -m "not integration"

all: clean install install_extras install_development_requirements test test_release_setup

Expand Down
68 changes: 47 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ This package is a plugin for the [pytest](https://docs.pytest.org/en/latest/) un
* Python 3.6+
* At least one of the supported workflow engines:
* [Miniwdl](https://github.com/chanzuckerberg/miniwdl) - automatically installed as a dependency of pytest-wdl
* [Cromwell](https://github.com/broadinstitute/cromwell/releases/tag/38) JAR file
* [Cromwell](https://github.com/broadinstitute/cromwell/releases/tag/48) JAR file
* **Cromwell Server**: Any Cromwell instance remotely running in Server mode
* [dxWDL](https://github.com/dnanexus/dxWDL) JAR file
* Java-based workflow engines (e.g. Cromwell and dxWDL) require a Java runtime (typically 1.8+)
* If your WDL tasks depend on Docker images, make sure to have the [Docker](https://www.docker.com/get-started) daemon running
Expand Down Expand Up @@ -48,6 +49,8 @@ The plugins that have extra dependencies are:

* dx: Support for DNAnexus file storage, and for the dxWDL executor.
* bam: More intelligent comparison of expected and actual BAM file outputs of a workflow than just comparing MD5 checksums.
* http: Support for executors that use HTTPS protocol to communicate with a remote server (e.g. Cromwell Server)
* yaml: Support using YAML for configuration and test data files.
* progress: Show progress bars when downloading remote files.

To install a plugin's dependencies:
Expand Down Expand Up @@ -79,25 +82,7 @@ See the [manual](https://pytest-wdl.readthedocs.io/en/stable/manual.html#configu

## Usage

The pytest-wdl plugin provides a set of fixtures for use with pytest. Here is a quick example:

```python
# test_variant_caller.py
def test_variant_caller(workflow_data, workflow_runner):
inputs = workflow_data.get_dict("bam", "bai")
inputs["index"] = {
"fasta": workflow_data["index_fa"],
"organism": "human"
}
expected = workflow_data.get_dict("vcf")
workflow_runner(
"variant_caller.wdl",
inputs,
expected
)
```

This test will execute a workflow (such as the following one) with the specified inputs, and will compare the outputs to the specified expected outputs.
The pytest-wdl plugin provides a set of fixtures for use with pytest. Here is a quick example that tests the following workflow.

```wdl
# variant_caller.wdl
Expand Down Expand Up @@ -130,7 +115,7 @@ workflow call_variants {
}
```

Input and output data are defined in a `test_data.json` file in the same directory as your test script:
Inputs and expected outputs are defined in a `test_data.json` file in the same directory as your test script:

```json
{
Expand All @@ -151,6 +136,47 @@ Input and output data are defined in a `test_data.json` file in the same directo
}
```

You can write the test code in Python, or - in most cases - you can define the test in a JSON or YAML file instead. The following Python and JSON code define exactly the same test. This test will cause the workflow to be run with the specified inputs, and the outputs will be compared to the specified expected outputs.

```python
# test_variant_caller.py
def test_variant_caller(workflow_data, workflow_runner):
inputs = workflow_data.get_dict("bam", "bai")
inputs["index"] = {
"fasta": workflow_data["index_fa"],
"organism": "human"
}
expected = workflow_data.get_dict("vcf")
workflow_runner(
"variant_caller.wdl",
inputs,
expected
)
```

```json
# test_variant_caller.json
{
"tests": [
{
"name": "test_variant_caller",
"wdl": "variant_caller.wdl",
"inputs": {
"bam": "bam",
"bai": "bai",
"index": {
"fasta": "index_fa",
"organism": "human"
}
},
"outputs": {
"vcf": "vcf"
}
}
]
}
```

For details, [read the docs](https://pytest-wdl.readthedocs.io).

## Contributing
Expand Down
Loading

0 comments on commit bcc43ee

Please sign in to comment.