From 161d3ce7ef4c37d529ecbbc9363a754843e98cf4 Mon Sep 17 00:00:00 2001 From: pared Date: Thu, 7 Mar 2019 16:10:55 +0100 Subject: [PATCH] yaml loading error: display relative path --- dvc/exceptions.py | 1 + tests/test_add.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/dvc/exceptions.py b/dvc/exceptions.py index c27bf3837..fb47d4391 100644 --- a/dvc/exceptions.py +++ b/dvc/exceptions.py @@ -212,6 +212,7 @@ class NoMetricsError(DvcException): class StageFileCorruptedError(DvcException): def __init__(self, path): + path = os.path.relpath(path) super(StageFileCorruptedError, self).__init__( "unable to read stage file: {} " "YAML file structure is corrupted".format(path) diff --git a/tests/test_add.py b/tests/test_add.py index 447b11d16..ae373f2c2 100644 --- a/tests/test_add.py +++ b/tests/test_add.py @@ -415,7 +415,7 @@ class TestShouldThrowProperExceptionOnCorruptedStageFile(TestDvc): ret = main(["add", self.FOO]) self.assertEqual(0, ret) - foo_stage = os.path.abspath(self.FOO + Stage.STAGE_FILE_SUFFIX) + foo_stage = os.path.relpath(self.FOO + Stage.STAGE_FILE_SUFFIX) # corrupt stage file with open(foo_stage, "a+") as file: