Skip to content

Commit

Permalink
fix(workflow): better error message when running non-eixisting workfl…
Browse files Browse the repository at this point in the history
…ow file
  • Loading branch information
m-alisafaee committed Jan 20, 2023
1 parent ff51a76 commit 1194f13
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 2 additions & 2 deletions renku/ui/cli/run.py
Expand Up @@ -562,10 +562,10 @@ def is_workflow_file() -> bool:
return False

path = Path(command_line[0])
if not path.is_file() or not is_subpath(path=path, base=project_context.path):
return False
if path.suffix.lower() in [".yml", ".yaml"] and not os.access(path, os.X_OK):
return True
if not path.is_file() or not is_subpath(path=path, base=project_context.path):
return False

try:
content = read_workflow_file(path=path)
Expand Down
9 changes: 9 additions & 0 deletions tests/cli/test_workflow_file.py
Expand Up @@ -82,6 +82,15 @@ def test_run_workflow_file_with_selected_steps(runner, workflow_file_project):
assert not (workflow_file_project.path / "results" / "output.csv.wc").exists()


def test_run_non_existing_workflow_file(runner, workflow_file_project):
"""Test running a non-existing workflow file gives proper error if file has YAML extension."""
result = runner.invoke(cli, ["run", "non-existing-workflow-file.yml"])

assert 2 == result.exit_code, format_result_exception(result)

assert "No such file or directory: 'non-existing-workflow-file.yml'" in result.output


def test_run_workflow_file_with_no_commit(runner, workflow_file_project):
"""Test running a workflow file with ``--no-commit`` option."""
commit_before = workflow_file_project.repository.head.commit.hexsha
Expand Down

0 comments on commit 1194f13

Please sign in to comment.