DEV.co
Open-Source Testing · Teemu

pytest-sugar

pytest-sugar is a pytest plugin that improves test output readability with progress bars, instant failure display, and better formatting. It automatically activates after installation and requires minimal configuration.

Source: GitHub — github.com/Teemu/pytest-sugar
1.5k
GitHub stars
83
Forks
Python
Primary language
BSD-3-Clause
License (OSI-approved)

Key facts

Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.

FieldValue
RepositoryTeemu/pytest-sugar
OwnerTeemu
Primary languagePython
LicenseBSD-3-Clause — OSI-approved
Stars1.5k
Forks83
Open issues33
Latest releasev1.1.1 (2025-08-23)
Last updated2025-12-12
Sourcehttps://github.com/Teemu/pytest-sugar

What pytest-sugar is

A Python pytest plugin that hooks into pytest's reporting system to provide real-time test failure display, progress visualization, and enhanced terminal output formatting. Supports Playwright trace file integration and requires Python 3.10+ with pytest 7+.

Quickstart

Get the pytest-sugar source

Clone the repository and explore it locally.

terminalbash
git clone https://github.com/Teemu/pytest-sugar.gitcd pytest-sugar# follow the project's README for install & configuration

Need it deployed, integrated, or customized instead? DEV.co ships production installs.

Best use cases

Local test development and debugging

Provides instant visual feedback on test failures with progress indication, reducing iteration time during active development.

CI/CD pipeline visibility

The --force-sugar flag enables enhanced output in non-terminal CI environments, improving log readability in automated pipelines.

Test-heavy projects with long suites

Progress bars and colored output help monitor long-running test sessions and quickly identify failing tests.

Implementation considerations

  • Plugin auto-activates post-install; disable with '-p no:sugar' if conflicts occur with other reporting tools.
  • Verify Playwright trace directory (--sugar-trace-dir) configuration if using Playwright; defaults to 'test-results'.
  • Test on target OS before production; Windows may require charset/font adjustments to avoid display corruption.
  • Check for output conflicts if using multiple pytest plugins that modify reporting (e.g., pytest-html, pytest-rich).
  • No configuration file support mentioned; all behavior configured via CLI flags or pytest.ini options only.

When to avoid it — and what to weigh

  • Strict log parsing required — If downstream tools parse pytest output programmatically, the enhanced formatting may break parsers expecting standard pytest output.
  • Machine-readable test reporting is primary — pytest-sugar prioritizes human-readable output; if you need structured JSON/XML reports, use pytest's native reporting instead.
  • Python < 3.10 or pytest < 7 — Project explicitly requires Python 3.10+ and pytest 7+; older versions are not supported.
  • Minimal terminal dependencies required — Plugin adds dependencies for colorization and terminal rendering; minimalist projects may prefer standard pytest output.

License & commercial use

BSD-3-Clause license permits commercial use, modification, and distribution with attribution and liability disclaimer.

BSD-3-Clause is a permissive OSI license allowing commercial use without runtime fees. Ensure compliance with attribution requirements in derivative distributions.

DEV.co evaluation signals

Editorial assessment — not user reviews. Directional, with an explicit confidence level.

SignalAssessment
MaintenanceActive
DocumentationAdequate
License clarityClear
Deployment complexityLow
DEV.co fitGood
Assessment confidenceHigh
Security considerations

Runs within pytest process; security impact limited to test environment. Reads local Playwright trace files and filesystem paths from CLI arguments. No authentication, remote calls, or data transmission mentioned. Standard Python dependency supply-chain review recommended.

Alternatives to consider

pytest-rich

Similar output enhancement using the Rich library; alternative formatting approach with different dependency footprint.

pytest-pretty

Another output formatter focused on readability; consider if Rich/pytest-rich architecture is preferred.

Standard pytest with --tb=short

Minimal alternative using pytest's built-in options; sufficient for basic failure visibility without plugin overhead.

Software development agency

Build on pytest-sugar with DEV.co software developers

pytest-sugar activates automatically after pip install. Run 'pytest' to see enhanced output with progress bars and instant failure feedback.

Talk to DEV.co

Related open-source tools

Surfaced by semantic similarity across the DEV.co open-source index.

Related on DEV.co

Explore the category and the services that help you build with it.

pytest-sugar FAQ

Does pytest-sugar work in CI/CD pipelines?
Yes, use the --force-sugar flag to enable output in non-terminal environments like GitHub Actions or Jenkins.
Can pytest-sugar be disabled per-run?
Yes, run 'pytest -p no:sugar' to skip the plugin for a single invocation.
Does pytest-sugar support Python 3.9 or older?
No, Python 3.10+ is required. Upgrade Python or use an older pytest-sugar version (not recommended).
How is Playwright trace integration used?
The plugin auto-detects Playwright trace files in test-results directory and displays them in output. Configure path via --sugar-trace-dir or disable with --sugar-no-trace.

Software development & web development with DEV.co

Need help beyond evaluating pytest-sugar? DEV.co is a software development agency offering software development services and web development for teams of every size. Our software developers and web developers build custom software, web applications, APIs, and open-source testing integrations — and maintain them long-term.

Ready to improve test visibility?

pytest-sugar activates automatically after pip install. Run 'pytest' to see enhanced output with progress bars and instant failure feedback.