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: