Skip to main content

pytest-pystack

CI PyPI - Python Version PyPI PyPI - Downloads Code Style

A pytest plug-in for easy integration of PyStack in your test suite.

It can be used to automatically dump the stack trace of a hanging test in your suite (with exception to test using pytester fixture).

See PyStack for further information about the tool.

Installation

To install the PyStack pytest plug-in, just run the following command in your venv:

python -m pip install pytest-pystack

Quick Start

After you have installed the pytest plug-in, you can have PyStack monitor your test suite and output a stack trace if a test takes more than 5 seconds, simply by running pytest with argument --pystack-threshold=5.

Configuration

The PyStack plug-in can be configured via the command line with the following options:

  • --pystack-threshold: Enables the plug-in and monitors all tests, generating a stack trace if they take longer than the specified threshold. Note, this neither stops nor fails the test case after the specified threshold.
  • --pystack-output-file: Appends PyStack output to a file.
  • --pystack-path: Path to the pystack executable.
  • --pystack-args: Additional args to pass to pystack remote <pid>, like --native or --native-all.

And through any pytest config file, see an example of pyproject.toml:

[tool.pytest.ini_options]
pystack_threshold=60
pystack_path="custom-version-of-pystack"
pystack_output_file="./pystack.log"
pystack_args="--native"

License

This project is Apache-2.0 licensed, as found in the LICENSE file.

Code of Conduct

This project has adopted a Code of Conduct. If you have any concerns about the Code, or behavior that you have experienced in the project, please contact us at opensource@bloomberg.net.

Contributing

We welcome your contributions to help us improve and extend this project!

Below you will find some basic steps required to be able to contribute to the project. If you have any questions about this process or any other aspect of contributing to a Bloomberg open source project, feel free to send an email to opensource@bloomberg.net and we'll get your questions answered as quickly as we can.

Contribution Licensing

Since this project is distributed under the terms of an open source license, contributions that you make are licensed under the same terms. For us to be able to accept your contributions, we will need explicit confirmation from you that you are able and willing to provide them under these terms, and the mechanism we use to do this is called a Developer's Certificate of Origin (DCO). This is similar to the process used by the Linux kernel, Samba, and many other major open source projects.

To participate under these terms, all that you must do is include a line like the following as the last line of the commit message for each commit in your contribution:

Signed-Off-By: Random J. Developer <random@developer.example.org>

The simplest way to accomplish this is to add -s or --signoff to your git commit command.

You must use your real name (sorry, no pseudonyms, and no anonymous contributions).

Steps

  • Create an Issue, select 'Feature Request', and explain the proposed change.
  • Follow the guidelines in the issue template presented to you.
  • Submit the Issue.
  • Submit a Pull Request and link it to the Issue by including "#" in the Pull Request summary.

Download files

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

Source Distribution

pytest_pystack-1.1.0.tar.gz (19.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pytest_pystack-1.1.0-py3-none-any.whl (15.6 kB view details)

Uploaded Python 3

File details

Details for the file pytest_pystack-1.1.0.tar.gz.

File metadata

  • Download URL: pytest_pystack-1.1.0.tar.gz
  • Upload date:
  • Size: 19.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for pytest_pystack-1.1.0.tar.gz
Algorithm Hash digest
SHA256 76bc9a07ad4da4cbbca065ad1f846ae96f8442de420fb0068a916c86a701dab8
MD5 20af386bcb5a617f444fc084b3200a61
BLAKE2b-256 5a44208cb6d4ffe135629f83f5068a7a8f79dbbfb80fd20f92d7396aed0a8253

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_pystack-1.1.0.tar.gz:

Publisher: build.yaml on bloomberg/pytest-pystack

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pytest_pystack-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: pytest_pystack-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 15.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for pytest_pystack-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 82d1d1049e29b834950202d73a52c153c98600d290284955aa7d18e52e975f4c
MD5 4d89f83056c6ab40939ef99d10237dd8
BLAKE2b-256 ba6f7fb37a176ef52ff82ae2fabf8c096df8cd656fe2fcadb39a99dba1b09e47

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_pystack-1.1.0-py3-none-any.whl:

Publisher: build.yaml on bloomberg/pytest-pystack

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page