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

Uploaded Source

Built Distribution

pytest_doorstop-1.0.0-py3-none-any.whl (17.7 kB view details)

Uploaded Python 3

File details

Details for the file pytest-doorstop-1.0.0.tar.gz.

File metadata

  • Download URL: pytest-doorstop-1.0.0.tar.gz
  • Upload date:
  • Size: 17.9 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for pytest-doorstop-1.0.0.tar.gz
Algorithm Hash digest
SHA256 85ea218d59d8210d321f5b766c9b6552b0646540d9b89de30d972363f9cc2606
MD5 6ab5f23beea6b5ec7682034c8b94e1ec
BLAKE2b-256 ddca3ee124b78c8a3705867077dc22165446119a68df6169825f7b42a54e3fcc

See more details on using hashes here.

File details

Details for the file pytest_doorstop-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: pytest_doorstop-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 17.7 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for pytest_doorstop-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 44780b37d5426b20041c3de06750a7736a33547a91377e1a4d53daafb626473a
MD5 05737b40eb00bb7c485395abc827c54d
BLAKE2b-256 53d27bd41d789e612184a3ae4e46cc37fb0c26ca68797b2a97d24d198abe98f5

See more details on using hashes here.

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