Skip to main content

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.

Metadata

Release files for pytest-doorstop 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytest-doorstop 1.0.0
File Size Uploaded
pytest-doorstop-1.0.0.tar.gz 17.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pytest-doorstop 1.0.0
File Interpreter ABI Platform
pytest_doorstop-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 35.6 kB

Release files / pytest-doorstop-1.0.0.tar.gz

Download URL pytest-doorstop-1.0.0.tar.gz
Size 17.9 kB
Tags Source
SHA-256 checksum
How to use checksums
85ea218d59d8210d321f5b766c9b6552b0646540d9b89de30d972363f9cc2606
BLAKE2b-256 checksum
How to use checksums
ddca3ee124b78c8a3705867077dc22165446119a68df6169825f7b42a54e3fcc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3.post20200325 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2

Release files / pytest_doorstop-1.0.0-py3-none-any.whl

Download URL pytest_doorstop-1.0.0-py3-none-any.whl
Size 17.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
44780b37d5426b20041c3de06750a7736a33547a91377e1a4d53daafb626473a
BLAKE2b-256 checksum
How to use checksums
53d27bd41d789e612184a3ae4e46cc37fb0c26ca68797b2a97d24d198abe98f5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3.post20200325 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page