Skip to content

Commit 42639f3

Browse files
nejchJohnVillalovos
authored andcommitted
refactor(artifacts): remove deprecated artifacts()in favor of artifacts.download()
BREAKING CHANGE: The deprecated `project.artifacts()` method is no longer available. Use `project.artifacts.download()` instead.
1 parent 5c8b7c1 commit 42639f3

File tree

4 files changed

+0
-61
lines changed

4 files changed

+0
-61
lines changed

docs/gl_objects/pipelines_and_jobs.rst

-5
Original file line numberDiff line numberDiff line change
@@ -255,11 +255,6 @@ a branch or tag::
255255

256256
project.artifacts.download(ref_name='main', job='build')
257257

258-
.. attention::
259-
260-
An older method ``project.artifacts()`` is deprecated and will be
261-
removed in a future version.
262-
263258
.. warning::
264259

265260
Artifacts are entirely stored in memory in this example.

gitlab/v4/objects/artifacts.py

-24
Original file line numberDiff line numberDiff line change
@@ -25,30 +25,6 @@ class ProjectArtifactManager(RESTManager):
2525
_path = "/projects/{project_id}/jobs/artifacts"
2626
_from_parent_attrs = {"project_id": "id"}
2727

28-
@cli.register_custom_action(
29-
"Project", ("ref_name", "job"), ("job_token",), custom_action="artifacts"
30-
)
31-
def __call__(
32-
self,
33-
*args: Any,
34-
**kwargs: Any,
35-
) -> Optional[bytes]:
36-
utils.warn(
37-
message=(
38-
"The project.artifacts() method is deprecated and will be removed in a "
39-
"future version. Use project.artifacts.download() instead.\n"
40-
),
41-
category=DeprecationWarning,
42-
)
43-
data = self.download(
44-
*args,
45-
**kwargs,
46-
)
47-
if TYPE_CHECKING:
48-
assert data is not None
49-
assert isinstance(data, bytes)
50-
return data
51-
5228
@exc.on_http_error(exc.GitlabDeleteError)
5329
def delete(self, **kwargs: Any) -> None:
5430
"""Delete the project's artifacts on the server.

tests/functional/cli/test_cli_artifacts.py

-23
Original file line numberDiff line numberDiff line change
@@ -77,29 +77,6 @@ def test_cli_project_artifact_download(gitlab_config, job_with_artifacts):
7777
assert is_zipfile(artifacts_zip)
7878

7979

80-
def test_cli_project_artifacts_warns_deprecated(gitlab_config, job_with_artifacts):
81-
cmd = [
82-
"gitlab",
83-
"--config-file",
84-
gitlab_config,
85-
"project",
86-
"artifacts",
87-
"--id",
88-
str(job_with_artifacts.pipeline["project_id"]),
89-
"--ref-name",
90-
job_with_artifacts.ref,
91-
"--job",
92-
job_with_artifacts.name,
93-
]
94-
95-
artifacts = subprocess.run(cmd, capture_output=True, check=True)
96-
assert isinstance(artifacts.stdout, bytes)
97-
assert b"DeprecationWarning" in artifacts.stderr
98-
99-
artifacts_zip = BytesIO(artifacts.stdout)
100-
assert is_zipfile(artifacts_zip)
101-
102-
10380
def test_cli_project_artifact_raw(gitlab_config, job_with_artifacts):
10481
cmd = [
10582
"gitlab",

tests/unit/objects/test_job_artifacts.py

-9
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,3 @@ def test_project_artifacts_download_by_ref_name(
4646
project = gl.projects.get(1, lazy=True)
4747
artifacts = project.artifacts.download(ref_name=ref_name, job=job)
4848
assert artifacts == binary_content
49-
50-
51-
def test_project_artifacts_by_ref_name_warns(
52-
gl, binary_content, resp_artifacts_by_ref_name
53-
):
54-
project = gl.projects.get(1, lazy=True)
55-
with pytest.warns(DeprecationWarning):
56-
artifacts = project.artifacts(ref_name=ref_name, job=job)
57-
assert artifacts == binary_content

0 commit comments

Comments
 (0)