(tmp_dir, dvc, run_head)
| 107 | |
| 108 | |
| 109 | def test_params_dump(tmp_dir, dvc, run_head): |
| 110 | tmp_dir.gen(FS_STRUCTURE) |
| 111 | |
| 112 | stage = run_head( |
| 113 | "foo", |
| 114 | "bar", |
| 115 | "foobar", |
| 116 | name="copy-first-line", |
| 117 | params=[ |
| 118 | "params2.yaml:answer,lists,name", |
| 119 | "params.yaml:lists,floats,nested.nested1,nested.nested1.nested2", |
| 120 | ], |
| 121 | ) |
| 122 | |
| 123 | initial_content = read_lock_file() |
| 124 | lock = initial_content["stages"]["copy-first-line"] |
| 125 | |
| 126 | # lock stage key order: |
| 127 | assert list(lock.keys()) == ["cmd", "deps", "params", "outs"] |
| 128 | assert list(lock["params"].keys()) == ["params.yaml", "params2.yaml"] |
| 129 | |
| 130 | # # params keys are always sorted by the name |
| 131 | assert list(lock["params"]["params.yaml"].keys()) == [ |
| 132 | "floats", |
| 133 | "lists", |
| 134 | "nested.nested1", |
| 135 | "nested.nested1.nested2", |
| 136 | ] |
| 137 | assert list(lock["params"]["params2.yaml"]) == ["answer", "lists", "name"] |
| 138 | |
| 139 | assert not dvc.reproduce(stage.addressing) |
| 140 | |
| 141 | # let's change the order of params and dump them in pipeline file |
| 142 | params, _ = split_params_deps(stage) |
| 143 | for param in params: |
| 144 | param.params.reverse() |
| 145 | |
| 146 | stage.dvcfile._dump_pipeline_file(stage) |
| 147 | assert not dvc.reproduce(stage.addressing) |
| 148 | |
| 149 | (tmp_dir / LOCK_FILE).unlink() |
| 150 | assert dvc.reproduce(stage.addressing) == [stage] |
| 151 | assert_eq_lockfile(initial_content, read_lock_file()) |
| 152 | |
| 153 | # remove build-cache and check if the same structure is built |
| 154 | for item in [dvc.stage_cache.cache_dir, LOCK_FILE]: |
| 155 | remove(item) |
| 156 | assert dvc.reproduce(stage.addressing) == [stage] |
| 157 | assert_eq_lockfile(initial_content, read_lock_file()) |
nothing calls this directly
no test coverage detected