Skip to content

[CHORE][PYTEST]: Add verbose test output option for real-time test name visibility #2665

@crivetimihai

Description

@crivetimihai

Overview

When running make test, pytest only shows dots (.) for passing tests due to parallel execution with pytest-xdist (-n 16). This makes it difficult to identify which tests are running or failing in real-time, especially during debugging sessions.


Current State

Makefile test target (line 546):

uv run --active pytest -n 16 --maxfail=0 -v --ignore=tests/fuzz

pyproject.toml addopts (line 592):

addopts = "-ra -q --ignore=tests/playwright --ignore=tests/migration --ignore=tests/performance"

Problem:

  • The -v flag is present but ineffective with -n 16 (xdist parallel mode)
  • With 16 workers running concurrently, output is aggregated as dots
  • Test names only appear after batches complete, not in real-time
  • Developers cannot see which test is failing until the entire suite completes

Proposed Implementation

Add a new test-verbose target for sequential execution with full test names:

test-verbose:
	@echo "🧪 Running tests (verbose, sequential)..."
	@test -d "$(VENV_DIR)" || $(MAKE) venv
	@/bin/bash -c "source $(VENV_DIR)/bin/activate && \
		export DATABASE_URL='sqlite:///:memory:' && \
		export TEST_DATABASE_URL='sqlite:///:memory:' && \
		export ARGON2ID_TIME_COST=1 && \
		export ARGON2ID_MEMORY_COST=1024 && \
		uv run --active pytest --maxfail=1 -v --tb=short --ignore=tests/fuzz"

Alternative: Add pytest-instafail for parallel + instant failure display:

# Add to dev dependencies
uv add --dev pytest-instafail

# Update test target
uv run --active pytest -n 16 --maxfail=1 -v --instafail --ignore=tests/fuzz

Options Comparison

Option Parallelism Real-time Names Use Case
test (current) 16 workers ❌ Dots only CI/CD, full suite
test-verbose (new) Sequential ✅ All names Debugging, development
test + instafail 16 workers ⚠️ Failures only Fast feedback on errors

Acceptance Criteria

  • Add test-verbose target to Makefile for sequential verbose output
  • Test names display in real-time when using make test-verbose
  • Document usage in Makefile help text
  • (Optional) Add pytest-instafail to dev dependencies for parallel failure visibility
  • Existing make test behavior unchanged (CI/CD compatibility)

Metadata

Metadata

Assignees

Labels

COULDP3: Nice-to-have features with minimal impact if left out; included if time permitschoreLinting, formatting, dependency hygiene, or project maintenance chorestest-automationAutomated testing

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions