From 2bf1b96bb0dfdf469963a15432961a1f630a2c64 Mon Sep 17 00:00:00 2001 From: davelopez <46503462+davelopez@users.noreply.github.com> Date: Tue, 20 May 2025 14:03:05 +0200 Subject: [PATCH 1/3] Fix WF Run RO-Crate logo width in Firefox --- .../Workflow/Invocation/Export/InvocationExportWizard.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/client/src/components/Workflow/Invocation/Export/InvocationExportWizard.vue b/client/src/components/Workflow/Invocation/Export/InvocationExportWizard.vue index 23c6d1d0c8d..5d085bc3179 100644 --- a/client/src/components/Workflow/Invocation/Export/InvocationExportWizard.vue +++ b/client/src/components/Workflow/Invocation/Export/InvocationExportWizard.vue @@ -480,6 +480,7 @@ Examples of RDM repositories include [Zenodo](https://zenodo.org/), [Invenio RDM height: auto; width: auto; max-height: 100px; + max-width: 100%; max-inline-size: -webkit-fill-available; } From 75ab3681184ee906757469294f88a96d57d5f381 Mon Sep 17 00:00:00 2001 From: John Davis Date: Tue, 3 Jun 2025 10:48:21 -0400 Subject: [PATCH 2/3] Use Role.name Fixes bug: the `name` hybrid property has been removed and the field has been renamed back to `_name` Ref: https://github.com/galaxyproject/galaxy/pull/19679/commits/3d2eb9fd8e6281d665ead0e18eb2f3ebde866196 https://github.com/galaxyproject/galaxy/pull/18966/commits/3e6191fbe3b5b1f18c6de2dfd413e9c2a6e34b19 https://github.com/galaxyproject/galaxy/pull/18966/commits/62a8b90f8aab45441b5f6922351b8a5a20cc0848 --- lib/galaxy/webapps/galaxy/controllers/admin.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/galaxy/webapps/galaxy/controllers/admin.py b/lib/galaxy/webapps/galaxy/controllers/admin.py index c6bf6506c75..a57402cbe64 100644 --- a/lib/galaxy/webapps/galaxy/controllers/admin.py +++ b/lib/galaxy/webapps/galaxy/controllers/admin.py @@ -191,7 +191,6 @@ class RoleListGrid(grids.GridData): ] def apply_query_filter(self, query, **kwargs): - # Note: we use Role._name (the column), not Role.name (which is a property) INDEX_SEARCH_FILTERS = { "description": "description", "name": "name", @@ -206,7 +205,7 @@ class RoleListGrid(grids.GridData): key = term.filter q = term.text if key == "name": - query = query.filter(text_column_filter(self.model_class._name, term)) + query = query.filter(text_column_filter(self.model_class.name, term)) if key == "description": query = query.filter(text_column_filter(self.model_class.description, term)) elif key == "is": @@ -217,7 +216,7 @@ class RoleListGrid(grids.GridData): raw_text_column_filter( [ self.model_class.description, - self.model_class._name, + self.model_class.name, ], term, ) From 6eaf8650734e8ccfb77fe40a0e8919db39fcaa9d Mon Sep 17 00:00:00 2001 From: Nicola Soranzo Date: Fri, 6 Jun 2025 19:51:15 +0100 Subject: [PATCH 3/3] Fix unit tests returning values These break with pytest 8.4.0, see https://docs.pytest.org/en/stable/changelog.html#pytest-8-4-0-2025-06-02 Fix the following errors in test_galaxy_packages tests: ``` FAILED tests/tool_shed/test_hg_util.py::test_add_file_and_commmit_changeset - Failed: Expected None, but test returned local('/tmp/pytest-of-runner/pytest-7/test_add_file_and_commmit_chan0/test.txt'). Did you mean to use `assert` instead of `return`? FAILED tests/tool_shed/test_hg_util.py::test_add_dir_and_commit_changeset - Failed: Expected None, but test returned local('/tmp/pytest-of-runner/pytest-7/test_add_dir_and_commit_change0/abc'). Did you mean to use `assert` instead of `return`? ``` Also: - Replace legacy `tmpdir` fixtures with `tmp_path`. - Improve type annotations. --- lib/tool_shed/util/hg_util.py | 12 ++-- test/unit/tool_shed/test_hg_util.py | 90 +++++++++++++++++------------ 2 files changed, 60 insertions(+), 42 deletions(-) diff --git a/lib/tool_shed/util/hg_util.py b/lib/tool_shed/util/hg_util.py index 4f2a03155c2..5ae4bec2e26 100644 --- a/lib/tool_shed/util/hg_util.py +++ b/lib/tool_shed/util/hg_util.py @@ -5,6 +5,7 @@ import subprocess import tempfile from datetime import datetime from time import gmtime +from typing import TYPE_CHECKING from galaxy.tool_shed.util import basic_util from galaxy.tool_shed.util.hg_util import ( @@ -21,12 +22,15 @@ from galaxy.tool_shed.util.hg_util import ( ) from galaxy.util import unicodify +if TYPE_CHECKING: + from galaxy.util.path import StrPath + log = logging.getLogger(__name__) INITIAL_CHANGELOG_HASH = "000000000000" -def add_changeset(repo_path, path_to_filename_in_archive): +def add_changeset(repo_path: "StrPath", path_to_filename_in_archive: "StrPath"): try: subprocess.check_output(["hg", "add", path_to_filename_in_archive], stderr=subprocess.STDOUT, cwd=repo_path) except Exception as e: @@ -51,7 +55,7 @@ def archive_repository_revision(app, repository, archive_dir, changeset_revision raise Exception(error_message) -def commit_changeset(repo_path: str, full_path_to_changeset: str, username: str, message: str) -> None: +def commit_changeset(repo_path: "StrPath", full_path_to_changeset: "StrPath", username: str, message: str) -> None: try: subprocess.check_output( ["hg", "commit", "-u", username, "-m", message, full_path_to_changeset], @@ -215,7 +219,7 @@ def get_rev_label_from_changeset_revision(repo, changeset_revision, include_date return rev, label -def remove_path(repo_path, selected_file): +def remove_path(repo_path: "StrPath", selected_file: "StrPath"): cmd = ["hg", "remove", "--force", selected_file] try: subprocess.check_output(cmd, stderr=subprocess.STDOUT, cwd=repo_path) @@ -236,7 +240,7 @@ def remove_path(repo_path, selected_file): raise Exception(error_message) -def init_repository(repo_path): +def init_repository(repo_path: "StrPath"): """ Create a new Mercurial repository in the given directory. """ diff --git a/test/unit/tool_shed/test_hg_util.py b/test/unit/tool_shed/test_hg_util.py index db6d009e84a..e6044238719 100644 --- a/test/unit/tool_shed/test_hg_util.py +++ b/test/unit/tool_shed/test_hg_util.py @@ -1,57 +1,71 @@ +from typing import TYPE_CHECKING + import pytest from tool_shed.util import hg_util - -def test_init_repository(tmpdir): - hg_util.init_repository(str(tmpdir)) - assert (tmpdir / ".hg").exists() +if TYPE_CHECKING: + from pathlib import Path -def test_init_repository_fails(tmpdir): - test_init_repository(tmpdir) - with pytest.raises(Exception) as exc_info: - test_init_repository(tmpdir) - assert "Error initializing repository" in str(exc_info.value) +def test_init_repository(tmp_path): + hg_util.init_repository(tmp_path) + assert (tmp_path / ".hg").exists() -def test_add_file_and_commmit_changeset(tmpdir): - test_init_repository(tmpdir) - path_to_add = tmpdir / "test.txt" - path_to_add.write("test") - hg_util.add_changeset(str(tmpdir), str(path_to_add)) - hg_util.commit_changeset(str(tmpdir), str(path_to_add), "testuser", "testcommit") +def test_init_repository_fails(tmp_path): + hg_util.init_repository(tmp_path) + with pytest.raises(Exception, match="Error initializing repository"): + test_init_repository(tmp_path) + + +def _add_file_and_commmit_changeset(tmp_path: "Path"): + path_to_add = tmp_path / "test.txt" + path_to_add.write_text("test") + hg_util.add_changeset(tmp_path, path_to_add) + hg_util.commit_changeset(tmp_path, path_to_add, "testuser", "testcommit") return path_to_add -def test_add_dir_and_commit_changeset(tmpdir): - test_init_repository(tmpdir) - path_to_add = tmpdir.mkdir("abc") - (path_to_add / "test.txt").write("bla") - hg_util.add_changeset(str(tmpdir), str(path_to_add)) - hg_util.commit_changeset(str(tmpdir), str(path_to_add), "testuser", "testcommit") - return path_to_add +def test_add_file_and_commmit_changeset(tmp_path): + hg_util.init_repository(tmp_path) + _add_file_and_commmit_changeset(tmp_path) -def test_remove_tracked_file(tmpdir): - path_to_remove = test_add_file_and_commmit_changeset(tmpdir) - hg_util.remove_path(str(tmpdir), path_to_remove) +def _add_dir_and_commit_changeset(tmp_path: "Path"): + dir_to_add = tmp_path / "abc" + dir_to_add.mkdir() + (dir_to_add / "test.txt").write_text("bla") + hg_util.add_changeset(tmp_path, dir_to_add) + hg_util.commit_changeset(tmp_path, dir_to_add, "testuser", "testcommit") + return dir_to_add -def test_remove_untracked_file(tmpdir): - test_init_repository(tmpdir) - untracked_path = tmpdir / "untracked.txt" - untracked_path.write("bla") - hg_util.remove_path(str(tmpdir), str(untracked_path)) +def test_add_dir_and_commit_changeset(tmp_path): + hg_util.init_repository(tmp_path) + _add_dir_and_commit_changeset(tmp_path) -def test_remove_tracked_dir(tmpdir): - path_to_remove = test_add_dir_and_commit_changeset(tmpdir) - hg_util.remove_path(str(tmpdir), path_to_remove) +def test_remove_tracked_file(tmp_path): + hg_util.init_repository(tmp_path) + path_to_remove = _add_file_and_commmit_changeset(tmp_path) + hg_util.remove_path(tmp_path, path_to_remove) -def test_remove_nonexistant_file_fails(tmpdir): - test_init_repository(tmpdir) - with pytest.raises(Exception) as exc_info: - hg_util.remove_path(str(tmpdir), str(tmpdir / "some path")) - assert "Error removing path" in str(exc_info.value) +def test_remove_untracked_file(tmp_path): + hg_util.init_repository(tmp_path) + untracked_path = tmp_path / "untracked.txt" + untracked_path.write_text("bla") + hg_util.remove_path(tmp_path, untracked_path) + + +def test_remove_tracked_dir(tmp_path): + hg_util.init_repository(tmp_path) + dir_to_remove = _add_dir_and_commit_changeset(tmp_path) + hg_util.remove_path(tmp_path, dir_to_remove) + + +def test_remove_nonexistant_file_fails(tmp_path): + hg_util.init_repository(tmp_path) + with pytest.raises(Exception, match="Error removing path"): + hg_util.remove_path(tmp_path, tmp_path / "some path")