fixed tests

This commit is contained in:
Nicholas Albion
2023-09-28 20:25:38 +10:00
parent 511ffdd8e1
commit ed003fb220
2 changed files with 8 additions and 4 deletions

View File

@@ -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)

View File

@@ -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):