{"id":20635725,"url":"https://github.com/lumc/pytest-workflow","last_synced_at":"2025-04-08T03:16:23.991Z","repository":{"id":37431606,"uuid":"160491851","full_name":"LUMC/pytest-workflow","owner":"LUMC","description":"Configure workflow/pipeline tests using yaml files.","archived":false,"fork":false,"pushed_at":"2024-08-04T23:43:53.000Z","size":781,"stargazers_count":67,"open_issues_count":18,"forks_count":10,"subscribers_count":6,"default_branch":"develop","last_synced_at":"2025-04-08T03:15:59.880Z","etag":null,"topics":["cromwell","miniwdl","nextflow","pipeline","pytest","pytest-plugin","snakemake","test","testing","wdl","wdl-devtools","workflow","workflow-testing","yaml"],"latest_commit_sha":null,"homepage":"https://pytest-workflow.readthedocs.io/en/stable/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LUMC.png","metadata":{"files":{"readme":"README.rst","changelog":"HISTORY.rst","contributing":"docs/CONTRIBUTING.rst","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-12-05T09:16:30.000Z","updated_at":"2025-03-27T15:03:22.000Z","dependencies_parsed_at":"2024-01-13T16:25:26.247Z","dependency_job_id":"a78d0f61-8b05-42a5-9d9c-dde884d62530","html_url":"https://github.com/LUMC/pytest-workflow","commit_stats":{"total_commits":1091,"total_committers":10,"mean_commits":109.1,"dds":0.09715857011915674,"last_synced_commit":"8e23a1ef75057600f06ebe543afc4b3b1ad551b3"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LUMC%2Fpytest-workflow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LUMC%2Fpytest-workflow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LUMC%2Fpytest-workflow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LUMC%2Fpytest-workflow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LUMC","download_url":"https://codeload.github.com/LUMC/pytest-workflow/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247767236,"owners_count":20992548,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cromwell","miniwdl","nextflow","pipeline","pytest","pytest-plugin","snakemake","test","testing","wdl","wdl-devtools","workflow","workflow-testing","yaml"],"created_at":"2024-11-16T15:06:53.367Z","updated_at":"2025-04-08T03:16:23.947Z","avatar_url":"https://github.com/LUMC.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"===============\npytest-workflow\n===============\n\n.. Badges have empty alts. So nothing shows up if they do not work.\n.. This fixes readthedocs issues with badges.\n.. image:: https://img.shields.io/pypi/v/pytest-workflow.svg\n  :target: https://pypi.org/project/pytest-workflow/\n  :alt:\n\n.. image:: https://img.shields.io/conda/v/conda-forge/pytest-workflow.svg\n  :target: https://anaconda.org/conda-forge/pytest-workflow\n  :alt:\n\n.. image:: https://img.shields.io/pypi/pyversions/pytest-workflow.svg\n  :target: https://pypi.org/project/pytest-workflow/\n  :alt:\n\n.. image:: https://img.shields.io/pypi/l/pytest-workflow.svg\n  :target: https://github.com/LUMC/pytest-workflow/blob/master/LICENSE\n  :alt:\n\n.. image:: https://travis-ci.org/LUMC/pytest-workflow.svg?branch=develop\n  :target: https://travis-ci.org/LUMC/pytest-workflow\n  :alt:\n\n.. image:: https://codecov.io/gh/LUMC/pytest-workflow/branch/develop/graph/badge.svg\n  :target: https://codecov.io/gh/LUMC/pytest-workflow\n  :alt:\n\n.. image:: https://zenodo.org/badge/DOI/10.5281/zenodo.3757727.svg\n  :target: https://doi.org/10.5281/zenodo.3757727\n  :alt: More information on how to cite pytest-workflow here.\n\npytest-workflow is a workflow-system agnostic testing framework that aims \nto make pipeline/workflow testing easy by using YAML files for the test \nconfiguration. Whether you write your pipelines in WDL, snakemake, nextflow, \nbash or any other workflow framework, pytest-workflow makes testing easy.\npytest-workflow is build on top of the pytest test framework.\n\nFor our complete documentation and examples checkout our\n`readthedocs page \u003chttps://pytest-workflow.readthedocs.io/\u003e`_.\n\n\nInstallation\n============\nPytest-workflow requires Python 3.7 or higher. It is tested on Python 3.7,\n3.8, 3.9, 3.10 and 3.11.\n\n- Make sure your virtual environment is activated.\n- Install using pip ``pip install pytest-workflow``\n- Create a ``tests`` directory in the root of your repository.\n- Create your test yaml files in the ``tests`` directory.\n\nPytest-workflow is also available as a `conda package on conda-forge\n\u003chttps://anaconda.org/conda-forge/pytest-workflow\u003e`_. Follow\n`these instructions \n\u003chttp://conda-forge.org/docs/user/introduction.html#how-can-i-install-packages-from-conda-forge\u003e`_ \nto set up channels properly in order to use conda-forge. Alternatively,\nyou can `set up the channels correctly for use with bioconda \n\u003chttps://bioconda.github.io/index.html#set-up-channels\u003e`_. After that ``conda\ninstall pytest-workflow`` can be used to install pytest-workflow. \n\nQuickstart\n==========\n\nRun ``pytest`` from an environment with pytest-workflow installed.\nPytest will automatically gather files in the ``tests`` directory starting with\n``test`` and ending in ``.yaml`` or ``.yml``.\n\nTo check the progress of a workflow while it is running you can use ``tail -f``\non the ``stdout`` or ``stderr`` file of the workflow. The locations of these\nfiles are reported in the log as soon as a workflow is started.\n\nFor debugging pipelines using the ``--kwd`` or ``--keep-workflow-wd`` flag  is\nrecommended. This will keep the workflow directory and logs after the test run\nso it is possible to check where the pipeline crashed. The ``-v`` flag can come\nin handy as well as it gives a complete overview of succeeded and failed tests.\n\nBelow is an example of a YAML file that defines a test:\n\n.. code-block:: yaml\n\n  - name: Touch a file\n    command: touch test.file\n    files:\n      - path: test.file\n\nThis will run ``touch test.file`` and check afterwards if a file with path:\n``test.file`` is present. It will also check if the ``command`` has exited\nwith exit code ``0``, which is the only default test that is run. Testing\nworkflows that exit with another exit code is also possible. Several other\npredefined tests as well as custom tests are possible.\n\n.. code-block:: yaml\n\n  - name: moo file                     # The name of the workflow (required)\n    command: bash moo_workflow.sh      # The command to execute the workflow (required)\n    files:                             # A list of files to check (optional)\n      - path: \"moo.txt\"                # File path. (Required for each file)\n        contains:                      # A list of strings that should be in the file (optional)\n          - \"moo\"\n        must_not_contain:              # A list of strings that should NOT be in the file (optional)\n          - \"Cock a doodle doo\"\n        md5sum: e583af1f8b00b53cda87ae9ead880224   # Md5sum of the file (optional)\n        encoding: UTF-8                # Encoding for the text file (optional). Defaults to system locale.\n\n  - name: simple echo                  # A second workflow. Notice the starting `-` which means\n    command: \"echo moo\"                # that workflow items are in a list. You can add as much workflows as you want\n    files:\n      - path: \"moo.txt\"\n        should_exist: false            # Whether a file should be there or not. (optional, if not given defaults to true)\n    stdout:                            # Options for testing stdout (optional)\n      contains:                        # List of strings which should be in stdout (optional)\n        - \"moo\"\n      must_not_contain:                # List of strings that should NOT be in stout (optional)\n        - \"Cock a doodle doo\"\n      encoding: ASCII                  # Encoding for stdout (optional). Defaults to system locale.\n\n  - name: mission impossible           # Also failing workflows can be tested\n    tags:                              # A list of tags that can be used to select which test\n      - should fail                    # is run with pytest using the `--tag` flag.\n    command: bash impossible.sh\n    exit_code: 2                       # What the exit code should be (optional, if not given defaults to 0)\n    files:\n      - path: \"fail.log\"               # Multiple files can be tested for each workflow\n      - path: \"TomCruise.txt.gz\"       # Gzipped files can also be searched, provided their extension is '.gz'\n        contains:\n          - \"starring\"\n        extract_md5sum: e27c52f6b5f8152aa3ef58be7bdacc4d   # Md5sum of the uncompressed file (optional)\n    stderr:                            # Options for testing stderr (optional)\n      contains:                        # A list of strings which should be in stderr (optional)\n        - \"BSOD error, please contact the IT crowd\"\n      must_not_contain:                # A list of strings which should NOT be in stderr (optional)\n        - \"Mission accomplished!\"\n      encoding: UTF-16                 # Encoding for stderr (optional). Defaults to system locale.\n\n  - name: regex tests\n    command: echo Hello, world\n    stdout:\n      contains_regex:                  # A list of regex patterns that should be in stdout (optional)\n        - 'Hello.*'                    # Note the single quotes, these are required for complex regexes\n        - 'Hello .*'                   # This will fail, since there is a comma after Hello, not a space\n\n      must_not_contain_regex:          # A list of regex patterns that should not be in stdout (optional)\n        - '^He.*'                      # This will fail, since the regex matches Hello, world\n        - '^Hello .*'                  # Complex regexes will break yaml if double quotes are used\n\nFor more information on how Python parses regular expressions, see the `Python\ndocumentation \u003chttps://docs.python.org/3/library/re.html\u003e`_.\n\nDocumentation for more advanced use cases including the custom tests can be\nfound on our `readthedocs page \u003chttps://pytest-workflow.readthedocs.io/\u003e`_.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flumc%2Fpytest-workflow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flumc%2Fpytest-workflow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flumc%2Fpytest-workflow/lists"}