-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconftest.py
More file actions
68 lines (56 loc) · 1.99 KB
/
Copy pathconftest.py
File metadata and controls
68 lines (56 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
"""Shared pytest fixtures for the copilot-experiments test suite."""
from __future__ import annotations
import sys
from pathlib import Path
import pytest
from copilot_experiments import Experiment, Task, Variant
FIXTURES = Path(__file__).parent / "fixtures"
# A portable verify command: succeeds only when a SOLVED marker exists.
_VERIFY = f'"{sys.executable}" -c "import os,sys; sys.exit(0 if os.path.exists(\'SOLVED\') else 1)"'
@pytest.fixture
def repo_root(tmp_path: Path) -> Path:
"""A throwaway experiment-repo root with the sample fixture copied in."""
fixtures = tmp_path / "fixtures" / "sample_task"
fixtures.mkdir(parents=True)
(fixtures / "seed.txt").write_text("seed\n", encoding="utf-8")
return tmp_path
@pytest.fixture
def experiment() -> Experiment:
return Experiment(
name="Sample Experiment",
description="A tiny experiment used by the test suite.",
task=Task(
prompt="Create a SOLVED file.",
fixture="fixtures/sample_task",
verify=_VERIFY,
),
variants=[
Variant(name="alpha", model="model-a"),
Variant(name="beta", model="model-b", trials=2),
],
)
@pytest.fixture
def multitask_experiment() -> Experiment:
"""A 2-task x 2-variant experiment exercising the task suite axis."""
return Experiment(
name="Suite Experiment",
description="A two-task suite used by the test suite.",
tasks=[
Task(
name="First Task",
prompt="Create a SOLVED file.",
fixture="fixtures/sample_task",
verify=_VERIFY,
),
Task(
name="Second Task",
prompt="Create a SOLVED file.",
fixture="fixtures/sample_task",
verify=_VERIFY,
),
],
variants=[
Variant(name="alpha", model="model-a"),
Variant(name="beta", model="model-b", trials=2),
],
)