Skip to content

Commit

Permalink
fixed test
Browse files Browse the repository at this point in the history
  • Loading branch information
nalbion committed Oct 12, 2023
1 parent 6f7b100 commit f166610
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
13 changes: 9 additions & 4 deletions pilot/utils/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down
4 changes: 2 additions & 2 deletions pilot/utils/test_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit f166610

Please sign in to comment.