From ed003fb220f50d3d8bfbc0f09b910bb443e46728 Mon Sep 17 00:00:00 2001 From: Nicholas Albion Date: Thu, 28 Sep 2023 20:25:38 +1000 Subject: [PATCH] fixed tests --- pilot/helpers/Project.py | 10 +++++++--- pilot/helpers/test_Project.py | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/pilot/helpers/Project.py b/pilot/helpers/Project.py index ae2da1b..b8bde11 100644 --- a/pilot/helpers/Project.py +++ b/pilot/helpers/Project.py @@ -249,10 +249,14 @@ class Project: if file_path != '': paths.insert(0, file_path) - if not re.match(r'^/|~|\w+:/', file_path): - paths.insert(0, self.root_path) + if file_path == '/': + absolute_path = file_path + file_name + else: + if not re.match(r'^/|~|\w+:', file_path): + paths.insert(0, self.root_path) + absolute_path = '/'.join(paths) - return file_path, '/'.join(paths) + return file_path, absolute_path def save_files_snapshot(self, development_step_id): files = get_files_content(self.root_path, ignore=IGNORE_FOLDERS) diff --git a/pilot/helpers/test_Project.py b/pilot/helpers/test_Project.py index a9fbffc..bce87cb 100644 --- a/pilot/helpers/test_Project.py +++ b/pilot/helpers/test_Project.py @@ -73,7 +73,7 @@ def test_get_full_path(file_path, file_name, expected): @pytest.mark.parametrize('file_path, file_name, expected', [ ('/file.txt', 'file.txt', '/file.txt'), ('/path/to/file.txt', 'file.txt', '/path/to/file.txt'), - ('C:\\path\\to\\file.txt', 'file.txt', 'C:\\path\\to\\file.txt'), + ('C:\\path\\to\\file.txt', 'file.txt', 'C:\\path\\to/file.txt'), ('~/path/to/file.txt', 'file.txt', '~/path/to/file.txt'), ]) def test_get_full_path_absolute(file_path, file_name, expected):