Optimize functions called during pytest test execution.
Linux/macOS
Windows
Copy
# Trace pytest testscodeflash optimize -m pytest tests/# Trace specific test filecodeflash optimize -m pytest tests/test_core.py# With pytest argumentscodeflash optimize -m pytest tests/ -v --tb=short
Copy
# Trace pytest testscodeflash optimize -m pytest tests\# Trace specific test filecodeflash optimize -m pytest tests\test_core.py# With pytest argumentscodeflash optimize -m pytest tests\ -v --tb=short
Tracing pytest tests is great for optimizing functions that are heavily used in your test suite, ensuring optimizations work correctly with your existing tests.
Create trace files and replay tests without running optimization.
Linux/macOS
Windows
Copy
# Trace only - generates replay testcodeflash optimize app.py --output trace_file.trace --trace-only# Then optimize using the replay testcodeflash --replay-test tests/test_app_py__replay_test_0.py --no-pr
Copy
# Trace only - generates replay testcodeflash optimize app.py --output trace_file.trace --trace-only# Then optimize using the replay testcodeflash --replay-test tests\test_app_py__replay_test_0.py --no-pr
Replay test naming: Files are named based on the traced script path. For
src/app.py, the replay test will be named like
test_srcapp_py__replay_test_0.py.
Use cases for trace-only:
Generate replay tests for later optimization
Debug tracing issues without running full optimization