Skip to content

Commit cf56115

Browse files
committed
verify input hooks are called exactly once per resolve
Signed-off-by: Maria Teresa Ortega <teresa.ortega0903@gmail.com>
1 parent 524b77a commit cf56115

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

test/core/test_input.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,3 +158,28 @@ def map(ctx):
158158

159159
nominal(output_dir="/tmp")
160160
assert seen == [("path/to/dataset.mcap", "path/to/map.yaml")]
161+
162+
163+
def test_input_hook_called_once_regardless_of_variants_and_iterations():
164+
"""Input hooks are resolved once, regardless of variants and iterations."""
165+
call_count = 0
166+
167+
@benchmark(
168+
variants=[
169+
{"sensor_model": "beam", "num_particles": 10},
170+
{"sensor_model": "lidar", "num_particles": 20},
171+
],
172+
num_iterations=3,
173+
)
174+
def nominal(ctx):
175+
pass
176+
177+
@nominal.input
178+
def dataset(ctx):
179+
nonlocal call_count
180+
call_count += 1
181+
return "path/to/dataset.mcap"
182+
183+
nominal(output_dir="/tmp")
184+
185+
assert call_count == 1

0 commit comments

Comments
 (0)