diff --git a/renku/ui/cli/run.py b/renku/ui/cli/run.py index 856800d17d..35ebb17b02 100644 --- a/renku/ui/cli/run.py +++ b/renku/ui/cli/run.py @@ -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) diff --git a/tests/cli/test_workflow_file.py b/tests/cli/test_workflow_file.py index 288bd2654d..e6af095957 100644 --- a/tests/cli/test_workflow_file.py +++ b/tests/cli/test_workflow_file.py @@ -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