Skip to content

Commit c4f5ec6

Browse files
nejchJohnVillalovos
authored andcommitted
refactor(objects): remove deprecated pipelines() method
BREAKING CHANGE: remove deprecated pipelines() methods in favor of pipelines.list()
1 parent 8236281 commit c4f5ec6

File tree

3 files changed

+1
-41
lines changed

3 files changed

+1
-41
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
* **release:** Allow to update release ([`b4c4787`](https://github.com/python-gitlab/python-gitlab/commit/b4c4787af54d9db6c1f9e61154be5db9d46de3dd))
2929
* **api:** Add group hooks ([`4a7e9b8`](https://github.com/python-gitlab/python-gitlab/commit/4a7e9b86aa348b72925bce3af1e5d988b8ce3439))
3030
* **api:** Remove responsibility for API inconsistencies for MR reviewers ([`3d985ee`](https://github.com/python-gitlab/python-gitlab/commit/3d985ee8cdd5d27585678f8fbb3eb549818a78eb))
31-
* **api:** Add MR pipeline manager in favor of pipelines() method ([`954357c`](https://github.com/python-gitlab/python-gitlab/commit/954357c49963ef51945c81c41fd4345002f9fb98))
31+
* **api:** Add MR pipeline manager and deprecate pipelines() method ([`954357c`](https://github.com/python-gitlab/python-gitlab/commit/954357c49963ef51945c81c41fd4345002f9fb98))
3232
* **api:** Add support for creating/editing reviewers in project merge requests ([`676d1f6`](https://github.com/python-gitlab/python-gitlab/commit/676d1f6565617a28ee84eae20e945f23aaf3d86f))
3333

3434
### Documentation

gitlab/v4/objects/pipelines.py

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import warnings
2-
31
from gitlab import cli
42
from gitlab import exceptions as exc
53
from gitlab.base import RequiredOptional, RESTManager, RESTObject
@@ -45,33 +43,6 @@ class ProjectMergeRequestPipelineManager(CreateMixin, ListMixin, RESTManager):
4543
_obj_cls = ProjectMergeRequestPipeline
4644
_from_parent_attrs = {"project_id": "project_id", "mr_iid": "iid"}
4745

48-
# If the manager was called directly as a callable via
49-
# mr.pipelines(), execute the deprecated method for now.
50-
# TODO: in python-gitlab 3.0.0, remove this method entirely.
51-
52-
@cli.register_custom_action("ProjectMergeRequest", custom_action="pipelines")
53-
@exc.on_http_error(exc.GitlabListError)
54-
def __call__(self, **kwargs):
55-
"""List the merge request pipelines.
56-
57-
Args:
58-
**kwargs: Extra options to send to the server (e.g. sudo)
59-
60-
Raises:
61-
GitlabAuthenticationError: If authentication is not correct
62-
GitlabListError: If the list could not be retrieved
63-
64-
Returns:
65-
RESTObjectList: List of changes
66-
"""
67-
warnings.warn(
68-
"Calling the ProjectMergeRequest.pipelines() method on "
69-
"merge request objects directly is deprecated and will be replaced "
70-
"by ProjectMergeRequest.pipelines.list() in python-gitlab 3.0.0.\n",
71-
DeprecationWarning,
72-
)
73-
return self.list(**kwargs)
74-
7546

7647
class ProjectPipeline(RefreshMixin, ObjectDeleteMixin, RESTObject):
7748
bridges: "ProjectPipelineBridgeManager"

tests/unit/objects/test_merge_request_pipelines.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,6 @@ def resp_create_merge_request_pipeline():
4040
yield rsps
4141

4242

43-
def test_merge_requests_pipelines_deprecated_raises_warning(
44-
project, resp_list_merge_request_pipelines
45-
):
46-
with pytest.deprecated_call():
47-
pipelines = project.mergerequests.get(1, lazy=True).pipelines()
48-
49-
assert len(pipelines) == 1
50-
assert isinstance(pipelines[0], ProjectMergeRequestPipeline)
51-
assert pipelines[0].sha == pipeline_content["sha"]
52-
53-
5443
def test_list_merge_requests_pipelines(project, resp_list_merge_request_pipelines):
5544
pipelines = project.mergerequests.get(1, lazy=True).pipelines.list()
5645
assert len(pipelines) == 1

0 commit comments

Comments
 (0)