codeflash/.codeflash/benchmarks/test_benchmark_discover_unit_tests.py
Kevin Turcios ec14860d29 Move benchmarks to .codeflash/benchmarks/ and auto-discover
Move codeflash's own benchmarks to .codeflash/benchmarks/. Add
auto-discovery of .codeflash/benchmarks/ in codeflash compare and
benchmark mode -- when benchmarks-root is not explicitly configured,
the CLI checks for .codeflash/benchmarks/ before erroring.

Backwards compatible: users with existing benchmarks-root config
are unaffected. Docs continue to show tests/benchmarks as the
example path.
2026-04-10 08:39:15 -05:00

28 lines
1 KiB
Python

from pathlib import Path
from codeflash.discovery.discover_unit_tests import discover_unit_tests
from codeflash.verification.verification_utils import TestConfig
def test_benchmark_code_to_optimize_test_discovery(benchmark) -> None:
project_path = Path(__file__).parent.parent.parent.resolve() / "code_to_optimize"
tests_path = project_path / "tests" / "pytest"
test_config = TestConfig(
tests_root=tests_path,
project_root_path=project_path,
test_framework="pytest",
tests_project_rootdir=tests_path.parent,
)
benchmark(discover_unit_tests, test_config)
def test_benchmark_codeflash_test_discovery(benchmark) -> None:
project_path = Path(__file__).parent.parent.parent.resolve() / "codeflash"
tests_path = project_path / "tests"
test_config = TestConfig(
tests_root=tests_path,
project_root_path=project_path,
test_framework="pytest",
tests_project_rootdir=tests_path.parent,
)
benchmark(discover_unit_tests, test_config)