From f166610249fbaac76400ea7ede701edeaf271ba3 Mon Sep 17 00:00:00 2001 From: Nicholas Albion Date: Thu, 12 Oct 2023 17:25:37 +1100 Subject: [PATCH] fixed test --- pilot/utils/files.py | 13 +++++++++---- pilot/utils/test_files.py | 4 ++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/pilot/utils/files.py b/pilot/utils/files.py index f1fba0cad..e7f372722 100644 --- a/pilot/utils/files.py +++ b/pilot/utils/files.py @@ -18,12 +18,17 @@ def setup_workspace(args) -> str: Also creates a 'tests' folder inside the workspace. :param args: may contain 'root' key """ - root = args.get('root') or get_parent_folder('pilot') - name = args.get('name', 'default_project_name') - project_path = create_directory(os.path.join(root, 'workspace'), name) + workspace = args.get('workspace') + if workspace: + project_path = workspace + else: + root = args.get('root') or get_parent_folder('pilot') + name = args.get('name', 'default_project_name') + project_path = create_directory(os.path.join(root, 'workspace'), name) + create_directory(project_path, 'tests') try: - save_user_app(args.get('user_id'), args.get('app_id'), name) + save_user_app(args.get('user_id'), args.get('app_id'), project_path) except Exception as e: print(str(e)) diff --git a/pilot/utils/test_files.py b/pilot/utils/test_files.py index 3856d5684..5c92faf00 100644 --- a/pilot/utils/test_files.py +++ b/pilot/utils/test_files.py @@ -3,9 +3,9 @@ def test_setup_workspace_with_existing_workspace(): - args = {'workspace': 'some_directory', 'name': 'sample'} + args = {'workspace': '/some/directory', 'name': 'sample'} result = setup_workspace(args) - assert result == 'some_directory' + assert result == '/some/directory' def mocked_create_directory(path, exist_ok=True):