Skip to main content

A pytest plugin for adding test results into doorstop items.

Project description

pytest-doorstop

PyPI Version PyPI - Python Version PyPI - License Sonarcloud Code style: black

A pytest plugin for adding test results into doorstop items.


Table of Contents


Features

  • Save pytest results to corresponding Doorstop items
  • For each test, writes extended attributes for:
    • Most recent test result
    • Commit hash of most recent test run
    • Commit hash where of the most recent successful test run
  • Supports PASS, FAIL, SKIP, XFAIL, and XPASS results
Test Outcome Outcome Written Update Last Run Commit? Update Last Passed Commit?
PASS (.) passed Yes Yes
FAIL (F) failed Yes No
SKIP (S) None No No
XPASS (X) xpass Yes Yes
XFAIL (x) xfail Yes No

Usage

The plugin needs to locate the Doorstop items, either by specifying the path to the Doorstop Document or by the item prefix. The results will not be recorded unless the plugin is specifically invoked with a command line argument.

If your project looks like this:

py-myproject/
+-- myproject/
|   +-- __init__.py
|   └-- myproject.py
|
+-- tests/
|   +-- __init__.py
|   +-- test_a.py
|   └-- test_b.py
|
+-- doorstop/
|   +-- .doorstop.yml
|   +-- TST001.yml
|   +-- TST002.yml
|   +-- TST003.yml
|   +-- TST004.yml
|   +-- TST005.yml
|   └-- TST006.yml
|
+-- license.txt
+-- readme.md
+-- requirements.txt
+-- setup.py

Then you can invoke the plugin either like this:

$ pytest --doorstop_path doorstop

Or like this

$ pytest --doorstop_prefix TST

In case the path is not specified, the plugin will search for a document with the given prefix in the CWD and any immediate child directories. Giving both arguments may be helpful for projects with complex directory structures.

The first Doorstop item file which contains the the test function name will have the extended attributes added / updated according to the results of the test. For example:

active: true
custom: 1
derived: false
header: ''
level: 4
links:
- REQ046: m9tMd0JM8O8idHTViqyYy1OL3dLiVY69bT63jNAGxPs=
normative: true
ref: test_yaml_encoding
reviewed: TIwopA6cvyjBMF17bB6p_RUNA7clNMaaEhXGYlAdpdk=
test_commit_last_passed: d670460b4b4aece5915caf5c68d12f560a9fe3e4
test_commit_latest: d670460b4b4aece5915caf5c68d12f560a9fe3e4
test_result_latest: passed
text: |
  Test that inputs can be loaded from a UTF-8 encoded YAML file.

Installation

You can install "pytest-doorstop" via pip from PyPI:

$ pip install pytest-doorstop

Dependencies

  • pytest
  • Doorstop
  • PyYAML
  • gitpython

Contributing

Contributions are very welcome, both in Issues and in Pull Requests. Tests can be run with tox.

$ tox

If you encounter any problems, please file an issue along with a detailed description.


License

Distributed under the terms of the GNU GPL v3.0 license, "pytest-doorstop" is free and open source software


This pytest plugin was generated with Cookiecutter along with @hackebrot's cookiecutter-pytest-plugin template.

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-doorstop-1.0.0.tar.gz (17.9 kB view hashes)

Uploaded Source

Built Distribution

pytest_doorstop-1.0.0-py3-none-any.whl (17.7 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