Pytest failures in PraisonAI fall into predictable categories that help distinguish real regressions from outdated test mocks.Documentation Index
Fetch the complete documentation index at: https://docs.praison.ai/llms.txt
Use this file to discover all available pages before exploring further.
Quick Start
Identify the Category
Run the one-liner check to identify which category your test failure belongs to.
Determine Real vs Stale
Use the verification commands to distinguish between real regressions and outdated mocks.
Failure Categories
Registry get_instance
Symptom:AttributeError where registry mock returns None instead of registry instance
One-liner check:
- Update mock patch target to match current registry location
- Verify mock returns actual registry instance, not None
- Check for singleton pattern changes in LLMProviderRegistry.get_instance()
execute_code Export
Symptom:ImportError on from praisonaiagents.tools import execute_code
One-liner check:
- Check TOOL_MAPPINGS in
praisonaiagents/tools/__init__.py - Verify execute_code is mapped to
.python_toolsmodule - Update import paths if module structure changed
Bot Lazy Loaders
Symptom: First call returnsNone instead of bot instance due to lazy loading bypass
One-liner check:
- Mock the lazy loading mechanism itself
- Ensure mocks cover both eager and lazy initialization paths
- Check for
__getattr__method changes in tools modules
aiui Patch Path
Symptom: Mock patch silently no-ops, test passes when it should fail One-liner check:mock.patch path
Common failure signature:
- Verify praisonaiui module location has not changed
- Update patch paths from
praisonai.aiuitopraisonaiuiif needed - Check for import alias changes (
import praisonaiui as aiui)
conftest Key Behavior
Symptom: Tests pass locally but fail in CI, or vice versa One-liner check:setup_test_environment only injects placeholder API keys when variables are unset or empty. Real keys from shell environment are preserved.
Fix approach:
unsetAPI keys before running unit tests to force placeholder injection- Use clean shell environment for consistent test behavior
- Mark tests as
real/network/e2eif they need real API keys
Troubleshooting Workflow
Before You Escalate Checklist
Before You Escalate Checklist
- Re-pull latest from main branch
- Re-install editable package:
pip install -e . - Check installed version:
pip show praisonai-agents - Run with verbose output:
pytest -vv --tb=long - Verify environment isolation (no stale imports)
Real Regression vs Stale Mock
Real Regression vs Stale Mock
Real Regression Signs:
- One-liner checks fail on fresh install
- Multiple unrelated tests failing simultaneously
- Recent SDK changes in related modules
- Failures persist after mock updates
- One-liner checks pass, only mocked tests fail
- Single test or module affected
- Mock targets non-existent paths/attributes
- Failures resolve with mock path updates
Mock Update Strategy
Mock Update Strategy
- Identify current API: Run one-liner to see actual behavior
- Update patch target: Match current module location
- Verify mock return: Ensure mock returns expected type
- Test both paths: Cover eager and lazy loading scenarios
When to Escalate
When to Escalate
Escalate to SDK maintainers when:
- One-liner checks confirm real API breakage
- Breaking changes affect multiple test categories
- Public API contracts have changed unexpectedly
- Fixes require SDK-level changes, not just test updates
Related
Testing Guide
Complete testing documentation and environment setup
Development Setup
Local development environment configuration

