(tmp_dir, dvc)
| 251 | |
| 252 | |
| 253 | def test_foreach_with_interpolated_wdir(tmp_dir, dvc): |
| 254 | resolver = DataResolver(dvc, (tmp_dir / "data").fs_path, {}) |
| 255 | foreach_data = ["foo", "bar"] |
| 256 | data = { |
| 257 | "foreach": foreach_data, |
| 258 | "do": {"wdir": "${item}", "cmd": "echo hello"}, |
| 259 | } |
| 260 | definition = ForeachDefinition(resolver, resolver.context, "build", data) |
| 261 | |
| 262 | assert definition.resolve_all() == { |
| 263 | # note that the resolver generates `wdir` relative to file's wdir |
| 264 | # so, this is just `foo`, not `data/foo`. |
| 265 | # figuring out `wdir` is the responsibility of the `load_stage`/`Stage` |
| 266 | "build@foo": {"wdir": "foo", "cmd": "echo hello"}, |
| 267 | "build@bar": {"wdir": "bar", "cmd": "echo hello"}, |
| 268 | } |
| 269 | |
| 270 | assert not resolver.context |
| 271 | assert not any(item for item in resolver.tracked_vars.values()) |
| 272 | |
| 273 | |
| 274 | def test_foreach_with_local_vars(tmp_dir, dvc): |
nothing calls this directly
no test coverage detected