Title: Add CLI-level test for import pipeline error handling in Bitbucket integration by Copilot · Pull Request #1085 · usethis-python/usethis-python · GitHub
Open Graph Title: Add CLI-level test for import pipeline error handling in Bitbucket integration by Copilot · Pull Request #1085 · usethis-python/usethis-python
X Title: Add CLI-level test for import pipeline error handling in Bitbucket integration by Copilot · Pull Request #1085 · usethis-python/usethis-python
Description: The issue raised concern that UnexpectedImportPipelineError could propagate unnecessarily to users when tools call update_bitbucket_steps(), which internally uses add_bitbucket_step_in_default().
Changes
Added test_import_pipeline_error_handled in tests/usethis/_ui/interface/test_interface_ci.py to verify the CLI handles import pipeline errors gracefully
The test uses CliRunner to test the usethis ci bitbucket command and ensures the error does NOT propagate as an unhandled exception:
def test_import_pipeline_error_handled(self, tmp_path: Path):
"""Test that import pipeline errors are handled gracefully at CLI level."""
# Arrange - create a bitbucket-pipelines.yml with an import pipeline
(tmp_path / "bitbucket-pipelines.yml").write_text(
"""\
image: atlassian/default-image:3
pipelines:
default:
import: shared-pipeline:master:share-pipeline-1
"""
)
# Add a tool so update_bitbucket_steps gets called
(tmp_path / "pytest.ini").touch()
# Act
runner = CliRunner()
with change_cwd(tmp_path):
result = runner.invoke_safe(app, ["--backend=none"])
# Assert - error should be caught and handled, not propagate as unhandled exception
assert result.exit_code == 1, result.output
assert "import pipeline" in result.output.lower()
This validates that the CLI layer properly catches UnexpectedImportPipelineError, displays an error message to the user, and exits gracefully with code 1 instead of propagating an unhandled exception.
Fixes #314
Original prompt
This section details on the original issue you should resolve
Open Graph Description: The issue raised concern that UnexpectedImportPipelineError could propagate unnecessarily to users when tools call update_bitbucket_steps(), which internally uses add_bitbucket_step_in_default(). C...
X Description: The issue raised concern that UnexpectedImportPipelineError could propagate unnecessarily to users when tools call update_bitbucket_steps(), which internally uses add_bitbucket_step_in_default(). C...
Opengraph URL: https://github.com/usethis-python/usethis-python/pull/1085
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:a3258f76-5528-4fe8-61fb-a5d03b2cb229 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 9504:10F0C1:113BFF:193105:6A4DFBEB |
| html-safe-nonce | f877c5afd5c9eb309f9b3fc15d6f3cadfd44f92d3ab93c6630ebdbdc3f6e705c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NTA0OjEwRjBDMToxMTNCRkY6MTkzMTA1OjZBNERGQkVCIiwidmlzaXRvcl9pZCI6IjYwMTM2NzM5MDY2NzM0MTcxOTYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | b7f91556e0e74e4e017ed521bfc0aeec44b8e815b2260b26af8a6ce5033f26b1 |
| hovercard-subject-tag | pull_request:2979243319 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/usethis-python/usethis-python/pull/1085/files |
| twitter:image | https://avatars.githubusercontent.com/in/1143301?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/in/1143301?s=400&v=4 |
| og:image:alt | The issue raised concern that UnexpectedImportPipelineError could propagate unnecessarily to users when tools call update_bitbucket_steps(), which internally uses add_bitbucket_step_in_default(). C... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5818716c93c6a2925b815402541a32814e43a7b1261c322b0c2df75224289566 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/usethis-python/usethis-python git https://github.com/usethis-python/usethis-python.git |
| octolytics-dimension-user_id | 216362695 |
| octolytics-dimension-user_login | usethis-python |
| octolytics-dimension-repository_id | 842189705 |
| octolytics-dimension-repository_nwo | usethis-python/usethis-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 842189705 |
| octolytics-dimension-repository_network_root_nwo | usethis-python/usethis-python |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 4314b1df11fa8a565684f3a72dc971e3785da365 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width