test¶
Description¶
Run tests for packages.
Required Parameters: None
Optional Parameters:
path (-p): Path to directory to test. (Default: None)
- If not provided, tests all packages
- Must be a valid directory containing tests
- Can be package root or specific test directory
watch (-w): Watch files for changes and re-run tests. (Default: False)
- Monitors file changes in real-time
- Re-runs tests when files are modified
- Useful for test-driven development
coverage_report (-c): Generate test coverage report. (Default: True)
- Creates detailed coverage analysis
- Shows line-by-line coverage stats
- Generates HTML report for visualization
Usage: Test all packages: adev test
Test specific directory:
adev test -p ./my_package
Test with file watching:
adev test -w
Test without coverage report:
adev test --no-coverage-report
Test specific directory with watching:
adev test -p ./my_package -w
Notes¶
Test Framework:
- Uses pytest as test runner
- Supports fixtures and markers
- Handles async tests
- Configurable via pytest.ini
Coverage:
- Tracks line and branch coverage
- Excludes test files from coverage
- Sets minimum coverage thresholds
- Generates HTML reports
Features:
- Parallel test execution
- JUnit XML reports
- Integration with CI/CD
- Detailed failure reporting
- Test categorization with markers
Error Handling:
- Reports test failures
- Shows detailed error traces
- Exits with error on failure
- Preserves test state on error