Skip to main content

pytest-sugar ✨

Build Status PyPI Version Downloads License

This plugin extends pytest by showing failures and errors instantly, adding a progress bar, improving the test results, and making the output look better.

render1667890332624-min

Installation

To install pytest-sugar:

python -m pip install pytest-sugar

Once installed, the plugin is activated automatically. Run your tests normally:

pytest

If you would like more detailed output (one test per line), then you may use the verbose option:

pytest --verbose

If you would like to run tests without pytest-sugar, use:

pytest -p no:sugar

Usage

pytest-sugar provides several command-line options to customize its output and behavior. These options enhance test reporting and Playwright trace integration:

Show detailed test failures instead of one-line tracebacks. Use this if you want to see the full failure information instantly.

--old-summary

Force pytest-sugar output even if pytest doesn’t detect a real terminal. Useful when running tests in CI systems or other non-interactive environments.

--force-sugar

Specify the directory where Playwright trace files are stored. Defaults to Playwright default: "test-results"

--sugar-trace-dir <directory>

Disable Playwright trace file detection and output display. Use this if you want to turn off trace collection or display entirely.

--sugar-no-trace

How to contribute 👷‍♂️

Open in GitHub Codespaces

Make sure to read our Code of Conduct. You can get started modifying the codebase with the following commands. Alternatively, you can try Github Codespaces (click the badge above). Push the changes to your repository & create a pull request.

git clone git@github.com:Teemu/pytest-sugar.git
cd pytest-sugar
python -m venv .venv
source .venv/bin/activate
echo ".venv" >> .git/info/exclude
pip install -e ".[dev]"
pre-commit install

There are two ways of running tests. We have our proper tests:

pytest .

There are also fake tests that can be used to visualise the output:

pytest faketests

When submitting a pull request, please add a RELEASE.md file in the root of the project that contains the release type (major, minor, patch) and a summary of the changes that will be used as the release changelog entry. For example:

Release type: patch

For long-running tests, display minutes and not only seconds.

Requirements

You will need the following prerequisites in order to use pytest-sugar:

  • Python 3.8 or newer
  • pytest 6.2 or newer

Running on Windows

If you are seeing gibberish, you might want to try changing charset and fonts. See this comment for more details.

Similar projects

Metadata

Release files for pytest-sugar 1.1.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-sugar 1.1.0
File Size Uploaded
pytest-sugar-1.1.0.tar.gz 16.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pytest-sugar 1.1.0
File Interpreter ABI Platform
pytest_sugar-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 27.7 kB

Release files / pytest-sugar-1.1.0.tar.gz

Download URL pytest-sugar-1.1.0.tar.gz
Size 16.3 kB
Tags Source
SHA-256 checksum
How to use checksums
53138645cabc311a677bb09c307eab41681a563e498318cd2a0d7cd184837af4
BLAKE2b-256 checksum
How to use checksums
c8fe012ae5c8cd4592d71e77c992a965064724269f4e60e377d5ce7b5ae01a19
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.23

Release files / pytest_sugar-1.1.0-py3-none-any.whl

Download URL pytest_sugar-1.1.0-py3-none-any.whl
Size 11.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c853866512288f1b679efc10c565303de4617854287e977781f07904f4560668
BLAKE2b-256 checksum
How to use checksums
ac134d703e1c389de100a4a943a4d1b2a315b787dffaff643fdaa0ffa13f985a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.23

Release history Release notifications | RSS feed

1.1.1

2 release files

This release

1.1.0 This release

2 release files

1.0.0

2 release files

0.9.7

2 release files

0.9.6

2 release files

0.9.5

2 release files

0.9.4

1 release file

0.9.3

1 release file

0.9.2

2 release files

0.9.1

1 release file

0.9.0

1 release file

0.8.0

2 release files

0.7.1

1 release file

0.7.0

1 release file

0.6.0

1 release file

0.5.1

1 release file

0.5.0

1 release file

0.4.0

1 release file

0.3.6

1 release file

0.3.5

1 release file

0.3.4

1 release file

0.3.3

1 release file

0.3.2

1 release file

0.3.1

1 release file

0.3.0

1 release file

0.2.4

1 release file

0.2.3

1 release file

0.2.2

1 release file

0.2.1

1 release file

0.2.0

1 release file

0.1.0

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