@@ -122,19 +122,17 @@ def make():
122122 {"actual" : 1 , "predicted" : 0 },
123123 ]
124124
125- (tmp_dir / "subdirA" ).mkdir ()
126- (tmp_dir / "subdirB" ).mkdir ()
127- (tmp_dir / "subdirA" / "linear_subdir_src.json" ).dump_json (linear_subdir_a_v1 )
128- (tmp_dir / "subdirB" / "linear_subdir_src.json" ).dump_json (linear_subdir_b_v1 )
125+ (tmp_dir / "linear_subdir_a_src.json" ).dump_json (linear_subdir_a_v1 )
126+ (tmp_dir / "linear_subdir_b_src.json" ).dump_json (linear_subdir_b_v1 )
129127 (tmp_dir / "linear_train_src.json" ).dump_json (linear_train_v1 )
130128 (tmp_dir / "linear_test_src.json" ).dump_json (linear_test_v1 )
131129 (tmp_dir / "confusion_train_src.json" ).dump_json (confusion_train_v1 )
132130 (tmp_dir / "confusion_test_src.json" ).dump_json (confusion_test_v1 )
133131
134132 scm .add (
135133 [
136- "subdirA/linear_subdir_src .json" ,
137- "subdirB/linear_subdir_src .json" ,
134+ "linear_subdir_a_src .json" ,
135+ "linear_subdir_b_src .json" ,
138136 "linear_train_src.json" ,
139137 "linear_test_src.json" ,
140138 "confusion_train_src.json" ,
@@ -143,15 +141,18 @@ def make():
143141 )
144142 scm .commit ("add data sources" )
145143
144+ (tmp_dir / "subdirA" ).mkdir ()
145+ (tmp_dir / "subdirB" ).mkdir ()
146+
146147 run_copy_metrics (
147- "subdirA/linear_subdir_src .json" ,
148+ "linear_subdir_a_src .json" ,
148149 "subdirA/linear_subdir.json" ,
149150 name = "linear_subdir" ,
150151 outs = ["subdirA/linear_subdir.json" ],
151152 commit = "linear_subdir" ,
152153 )
153154 run_copy_metrics (
154- "subdirB/linear_subdir_src .json" ,
155+ "linear_subdir_b_src .json" ,
155156 "subdirB/linear_subdir.json" ,
156157 name = "linear_subdir" ,
157158 outs = ["subdirB/linear_subdir.json" ],
@@ -185,15 +186,16 @@ def make():
185186 outs = ["confusion_test.json" ],
186187 commit = "confusion_test" ,
187188 )
188- plots_config = [
189- {
190- "subdirA" : {
191- "x" : "x" ,
192- "y" : "y" ,
193- "title" : "subdir plots with x and y defined" ,
194- }
195- },
196- {"subdirB" : {"title" : "subdir plots with default x and y" }},
189+
190+ subdir_a_config = {
191+ "x" : "x" ,
192+ "y" : "y" ,
193+ "title" : "subdir plots with x and y defined" ,
194+ }
195+
196+ subdir_b_config = {"title" : "subdir plots with default x and y" }
197+
198+ other_plots_config = [
197199 {
198200 "linear_train_vs_test" : {
199201 "x" : "x" ,
@@ -216,10 +218,19 @@ def make():
216218 from dvc .utils .serialize import modify_yaml
217219
218220 with modify_yaml ("dvc.yaml" ) as dvcfile_content :
219- dvcfile_content ["plots" ] = plots_config
221+ dvcfile_content ["plots" ] = [
222+ {"subdirA" : subdir_a_config },
223+ {"subdirB" : subdir_b_config },
224+ * other_plots_config ,
225+ ]
220226
221227 scm .add (["dvc.yaml" , "dvc.lock" ])
222228 scm .commit ("commit dvc files" )
229+
230+ # remove generate .gitignore that are considered as plot otherwise
231+ (tmp_dir / "subdirA" / ".gitignore" ).unlink ()
232+ (tmp_dir / "subdirB" / ".gitignore" ).unlink ()
233+
223234 yield {
224235 "data" : {
225236 "subdirA/linear_subdir.json" : linear_subdir_a_v1 ,
@@ -229,7 +240,13 @@ def make():
229240 "confusion_train.json" : confusion_train_v1 ,
230241 "confusion_test.json" : confusion_test_v1 ,
231242 },
232- "configs" : {"dvc.yaml" : plots_config },
243+ "configs" : {
244+ "dvc.yaml" : [
245+ {"subdirA/linear_subdir.json" : subdir_a_config },
246+ {"subdirB/linear_subdir.json" : subdir_b_config },
247+ * other_plots_config ,
248+ ]
249+ },
233250 }
234251
235252 return make
0 commit comments