@@ -135,9 +135,12 @@ Runs on every PR and push to main:
135135- ** Lint** : Ruff linting (` uv run ruff check src/ ` )
136136- ** Format Check** : Ruff formatting (` uv run ruff format --check src/ ` )
137137- ** Type Check** : mypy static analysis (` uv run mypy src/promptfoo/ ` )
138- - ** Tests** : pytest on multiple Python versions (3.9, 3.13) and OSes (Ubuntu, Windows)
138+ - ** Unit Tests** : Fast tests with mocked dependencies (` uv run pytest -m 'not smoke' ` )
139+ - ** Smoke Tests** : Integration tests against real CLI (` uv run pytest tests/smoke/ ` )
139140- ** Build** : Package build validation
140141
142+ Tests run on multiple Python versions (3.9, 3.13) and OSes (Ubuntu, Windows).
143+
141144### Release Workflow (` .github/workflows/release-please.yml ` )
142145
143146Triggered on push to main:
@@ -214,7 +217,38 @@ uv run pytest
214217
215218### Test Structure
216219
217- Tests are located in the root directory (not yet created, but should be in ` tests/ ` when added).
220+ Tests are organized in the ` tests/ ` directory:
221+
222+ ```
223+ tests/
224+ ├── __init__.py
225+ ├── test_cli.py # Unit tests for CLI wrapper logic
226+ ├── test_environment.py # Unit tests for environment detection
227+ ├── test_instructions.py # Unit tests for installation instructions
228+ └── smoke/
229+ ├── __init__.py
230+ ├── README.md # Smoke test documentation
231+ ├── test_smoke.py # Integration tests against real CLI
232+ └── fixtures/
233+ └── configs/ # YAML configs for smoke tests
234+ ├── basic.yaml
235+ ├── assertions.yaml
236+ └── failing-assertion.yaml
237+ ```
238+
239+ ### Test Types
240+
241+ ** Unit Tests** (` tests/test_*.py ` ):
242+ - Fast, isolated tests for individual functions
243+ - Mock external dependencies
244+ - Run on every PR
245+
246+ ** Smoke Tests** (` tests/smoke/ ` ):
247+ - Integration tests that run the actual CLI via subprocess
248+ - Use the ` echo ` provider (no external API dependencies)
249+ - Test the full Python → Node.js integration
250+ - Slower but verify end-to-end functionality
251+ - Marked with ` @pytest.mark.smoke `
218252
219253### Test Matrix
220254
@@ -229,16 +263,36 @@ CI tests across:
229263# Install dependencies with dev extras
230264uv sync --extra dev
231265
232- # Run all tests
266+ # Run all tests (unit + smoke)
233267uv run pytest
234268
269+ # Run only unit tests (fast)
270+ uv run pytest -m ' not smoke'
271+
272+ # Run only smoke tests (slow, requires Node.js)
273+ uv run pytest tests/smoke/
274+
235275# Run with coverage
236276uv run pytest --cov=src/promptfoo
237277
278+ # Run specific test class
279+ uv run pytest tests/test_cli.py::TestMainFunction
280+
238281# Run specific test
239- uv run pytest tests/test_cli .py::test_wrapper_detection
282+ uv run pytest tests/smoke/test_smoke .py::TestEvalCommand::test_basic_eval
240283```
241284
285+ ### Smoke Test Details
286+
287+ Smoke tests verify critical CLI functionality:
288+ - ** Basic CLI** : ` --version ` , ` --help ` , unknown commands, missing files
289+ - ** Eval Command** : Output formats (JSON, YAML, CSV), flags (` --repeat ` , ` --verbose ` )
290+ - ** Exit Codes** : 0 for success, 100 for assertion failures, 1 for errors
291+ - ** Echo Provider** : Variable substitution, multiple variables
292+ - ** Assertions** : ` contains ` , ` icontains ` , failing assertions
293+
294+ The smoke tests use a 120-second timeout to accommodate the first ` npx ` call which downloads promptfoo.
295+
242296## Security Practices
243297
244298### 1. No Credentials in Repository
@@ -365,14 +419,23 @@ promptfoo-python/
365419├── src/
366420│ └── promptfoo/
367421│ ├── __init__.py # Package exports
368- │ └── cli.py # Main wrapper implementation
422+ │ ├── cli.py # Main wrapper implementation
423+ │ ├── environment.py # Environment detection
424+ │ └── instructions.py # Node.js installation instructions
425+ ├── tests/
426+ │ ├── test_cli.py # Unit tests for CLI
427+ │ ├── test_environment.py # Unit tests for environment detection
428+ │ ├── test_instructions.py # Unit tests for instructions
429+ │ └── smoke/
430+ │ ├── test_smoke.py # Integration smoke tests
431+ │ └── fixtures/configs/ # Test configuration files
369432├── AGENTS.md # This file (agent documentation)
370433├── CHANGELOG.md # Auto-generated by release-please
371434├── CLAUDE.md # Points to AGENTS.md
372435├── LICENSE # MIT License
373436├── README.md # User-facing documentation
374437├── pyproject.toml # Package configuration
375- ├── release-please-config.json # Release-please configuration
438+ ├── release-please-config.json # Release-please configuration
376439└── .release-please-manifest.json # Release version tracking
377440```
378441
@@ -443,5 +506,5 @@ git push --force
443506
444507---
445508
446- ** Last Updated** : 2026-01-05
509+ ** Last Updated** : 2026-01-11
447510** Maintained By** : @promptfoo/engineering
0 commit comments