diff --git a/avocado/core/test.py b/avocado/core/test.py index eb79e2960e..6045747478 100644 --- a/avocado/core/test.py +++ b/avocado/core/test.py @@ -162,7 +162,7 @@ def _get_datadir(self, source): return os.path.join(*paths) - def get_data(self, filename, source=None, must_exist=True): + def get_data(self, filename, source=None, must_exist=True, abs_path=False): """ Retrieves the path to a given data file. @@ -202,7 +202,10 @@ def get_data(self, filename, source=None, must_exist=True): path, (f"assumed to be located at " f"{attempt_source} source dir"), ) - return path + if not abs_path: + return os.path.abspath(path) + else: + return path else: if os.path.exists(path): self.log.debug( @@ -211,7 +214,10 @@ def get_data(self, filename, source=None, must_exist=True): path, f"found at {attempt_source} source dir", ) - return path + if not abs_path: + return os.path.abspath(path) + else: + return path self.log.debug( log_fmt, filename, "NOT FOUND", f"data sources: {', '.join(sources)}"