Skip to content

Commit 1a413d7

Browse files
Add CLI-level test for import pipeline error handling in Bitbucket integration (#1085)
* Initial plan * Add test for add_bitbucket_step_in_default with import pipeline Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.com> * Move test to CLI level and verify import pipeline errors are handled Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.com>
1 parent e7563ee commit 1a413d7

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

tests/usethis/_ui/interface/test_interface_ci.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,3 +135,26 @@ def test_invalid_pyproject_toml(self, tmp_path: Path):
135135

136136
# Assert
137137
assert result.exit_code == 1, result.output
138+
139+
def test_import_pipeline_error_handled(self, tmp_path: Path):
140+
"""Test that import pipeline errors are handled gracefully at CLI level."""
141+
# Arrange - create a bitbucket-pipelines.yml with an import pipeline
142+
(tmp_path / "bitbucket-pipelines.yml").write_text(
143+
"""\
144+
image: atlassian/default-image:3
145+
pipelines:
146+
default:
147+
import: shared-pipeline:master:share-pipeline-1
148+
"""
149+
)
150+
# Add a tool so update_bitbucket_steps gets called
151+
(tmp_path / "pytest.ini").touch()
152+
153+
# Act
154+
runner = CliRunner()
155+
with change_cwd(tmp_path):
156+
result = runner.invoke_safe(app, ["--backend=none"])
157+
158+
# Assert - error should be caught and handled, not propagate as unhandled exception
159+
assert result.exit_code == 1, result.output
160+
assert "import pipeline" in result.output.lower()

0 commit comments

Comments
 (0)