Improve OverlappingOutputsError exception message. (#5015)

* trie: updated message for OverlappingOutputsError

the message given by the exception was not verbose enough why this exception is thrown.
now gives the user more information as to why the overlapping paths should be changed.

* test_run_single_stage: fixed test TestShouldRaiseOnOverlappingOutputPaths

the test is now updated to reflect the exception message changes.

Signed-off-by: metalglove <[email protected]>
This commit is contained in:
metalglove
2020-12-08 17:28:53 +05:45
committed by GitHub
parent 821ec0a934
commit a41e23a453
2 changed files with 8 additions and 6 deletions
+4 -3
View File
@@ -25,9 +25,10 @@ def build_outs_trie(stages):
overlapping = out
if parent and overlapping:
msg = (
"Paths for outs:\n'{}'('{}')\n'{}'('{}')\n"
"overlap. To avoid unpredictable behaviour, "
"rerun command with non overlapping outs paths."
"The output paths:\n'{}'('{}')\n'{}'('{}')\n"
"overlap and are thus in the same tracked directory.\n"
"To keep reproducibility, outputs should be in separate "
"tracked directories or tracked individually."
).format(
str(parent),
parent.stage.addressing,
+4 -3
View File
@@ -830,14 +830,15 @@ class TestShouldRaiseOnOverlappingOutputPaths(TestDvc):
data_dir_stage = self.DATA_DIR + DVC_FILE_SUFFIX
data_stage = os.path.basename(self.DATA) + DVC_FILE_SUFFIX
self.assertIn("Paths for outs:\n", error_output)
self.assertIn("The output paths:\n", error_output)
self.assertIn(
f"\n'{self.DATA_DIR}'('{data_dir_stage}')\n", error_output,
)
self.assertIn(f"\n'{self.DATA}'('{data_stage}')\n", error_output)
self.assertIn(
"\noverlap. To avoid unpredictable behaviour, rerun "
"command with non overlapping outs paths.",
"overlap and are thus in the same tracked directory.\n"
"To keep reproducibility, outputs should be in separate "
"tracked directories or tracked individually.",
error_output,
)