mirror of
https://github.com/codeflash-ai/codeflash.git
synced 2026-05-04 18:25:17 +00:00
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.
28 lines
1 KiB
Python
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)
|