Skip to main content

A pytest plugin for configuring workflow/pipeline tests using YAML files

Project description

pytest-workflow is a pytest plugin that aims to make pipeline/workflow testing easy by using yaml files for the test configuration.

For our complete documentation checkout our readthedocs page.

Installation

Pytest-workflow requires Python 3.5 or higher. It is tested on Python 3.5, 3.6 and 3.7. Python 2 is not supported.

  • Make sure your virtual environment is activated.

  • Install using pip pip install pytest-workflow

  • Create a tests directory in the root of your repository.

  • Create your test yaml files in the tests directory.

Quickstart

Run pytest from an environment with pytest-workflow installed. Pytest will automatically gather files in the tests directory starting with test and ending in .yaml or .yml.

For debugging pipelines running pytest -v --keep-workflow-wd is recommended. This will save the logs and the workflow directory so it is possible to check where the pipeline crashed. It will also give a better overview of succeeded and failed tests.

Below is an example of a YAML file that defines a test:

- name: Touch a file
  command: touch test.file
  files:
    - path: test.file

This will run touch test.file and check afterwards if a file with path: test.file is present. It will also check if the command has exited with exit code 0, which is the only default test that is run. Testing workflows that exit with another exit code is also possible.

Documentation for more advanced use cases can be found on our readthedocs page.

Project details


Download files

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

Source Distribution

pytest-workflow-0.4.0.tar.gz (16.1 kB view hashes)

Uploaded Source

Built Distribution

pytest_workflow-0.4.0-py3-none-any.whl (31.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page