Skip to main content

Fixtures for pytest for running WDL workflows using Cromwell.

Project description


Travis CI Code Coverage Documentation Status

This package is a plugin for the pytest unit testing framework that enables testing of workflows written in Workflow Description Language.


  • Python 3.6+
  • Java 1.8+
  • Cromwell JAR file
  • Docker daemon (if your WDL tasks depend on Docker images)

Other python dependencies are installed when you install the library.


Install from PyPI

$ pip install pytest-wdl

Install from source

You can to clone the repository and install:

$ make install

Or use pip to install from github:

$ pip install git+

Install optional dependencies

Some optional features of pytest-wdl have additional dependencies that are loaded on-demand. For example, to enable comparison of expected and actual BAM file outputs of a workflow, the pysam library is required.

The following data types require an "extras" installation:

  • bam

To install the dependencies for a data type that has extra dependencies:

$ pip install pytest-wdl[<data_type>]

To do this locally, you can clone the repo and run:

$ pip install -e .[<data_type>]

To install pytest-wdl and all extras dependencies:

$ pip install pytest-wdl[all]


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

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")

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.

# variant_caller.wdl
version 1.0

struct Index {
  File fasta
  String organism

workflow call_variants {
  input {
    File bam
    File bai
    Index index
  output {
    File vcf = variant_caller.vcf

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

  "bam": {
    "url": ""
  "bai": {
    "url": ""
  "index_fa": {
    "name": "chr22.fasta"
  "vcf": {
    "url": "",
    "type": "vcf",
    "allowed_diff_lines": 2

For details, read the docs.


To develop pytest-wdl, clone the repository and install all the dependencies:

$ git clone
$ pip install -r requirements.txt

To run the full build and unit tests, run:

$ make

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pytest-wdl, version 1.0.1
Filename, size File type Python version Upload date Hashes
Filename, size pytest-wdl-1.0.1.tar.gz (2.3 MB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page