From 3a5200f95bba6536aec8ad1ad5025a6b8aa5a81f Mon Sep 17 00:00:00 2001 From: PhilNewm Date: Tue, 12 Nov 2024 11:07:00 +0100 Subject: [PATCH 1/3] Extend test suite Fix minor bugs --- src/conversion_logic.py | 34 ++++++++++-- tests/formatted_changelog.md | 2 +- tests/formatted_changelog_icons.md | 83 ++++++++++++++++++++++++++++++ tests/merged_pr_query.json | 8 +-- tests/test_github_query.py | 64 ++++++++++++++++++++--- 5 files changed, 175 insertions(+), 16 deletions(-) create mode 100644 tests/formatted_changelog_icons.md diff --git a/src/conversion_logic.py b/src/conversion_logic.py index 13ddaa6..23ecb69 100644 --- a/src/conversion_logic.py +++ b/src/conversion_logic.py @@ -1,5 +1,6 @@ import logging import re +import unicodedata from typing import NamedTuple, List @@ -167,14 +168,16 @@ def format_changelog_markdown(changes: List[Changelog], changelog_label_list: Li change_label_list: set[str] = {label for change in changes for label in change.labels} for label in changelog_label_list: - if label not in change_label_list: + filtered_label: str = filter_emote(label) + + if filtered_label not in change_label_list: continue - formatted_label: str = label.removeprefix("type: ").capitalize() - changelog += f"\n### **{formatted_label}**\n\n" + formatted_label: str = format_label(label) + changelog += f"\n### {formatted_label}\n\n" for change in changes: - if label in change.labels: + if filtered_label in change.labels: changelog += f"
\n" changelog += f"{change.title} - #{change.number}\n\n" @@ -188,4 +191,25 @@ def format_changelog_markdown(changes: List[Changelog], changelog_label_list: Li changelog += f"\n___\n\n" changelog += f"
\n" - return changelog \ No newline at end of file + return changelog + +def filter_emote(text: str) -> str: + emojis: List[str] = [char for char in text if unicodedata.category(char) == 'So'] + + if emojis: + return text.split("(")[0] + + return text + +def format_label(text: str) -> str: + emojis: List[str] = [char for char in text if unicodedata.category(char) == 'So'] + + if not text: + return "" + + if emojis: + label: str = text.split("(")[0] + + return f"{emojis[0]} **{label.removeprefix('type: ').capitalize()}**" + + return f"**{text.removeprefix('type: ').capitalize()}**" diff --git a/tests/formatted_changelog.md b/tests/formatted_changelog.md index 2990b84..288e5cf 100644 --- a/tests/formatted_changelog.md +++ b/tests/formatted_changelog.md @@ -25,7 +25,7 @@ ___ -### **Bug** +### **Bugfix**
AY-6654 Look: Fix None values in collecting and applying attributes - #89 diff --git a/tests/formatted_changelog_icons.md b/tests/formatted_changelog_icons.md new file mode 100644 index 0000000..2c2c69a --- /dev/null +++ b/tests/formatted_changelog_icons.md @@ -0,0 +1,83 @@ +# Changelog + +### 💚 **Enhancement** + +
+Improve applying render resolution and aspect ratio on render settings reset - #75 + + +Fix pixel aspect ratio / device aspect ratio getting messed up for Arnold renderer on render settings reset. + +Additionally: +- This now applies the resolution from the task entity, not the folder entity. +- This now also applies pixel aspect ratio as defined on the entity. + +___ + +
+
+Validate unique names only within the instance not in full scene - #70 + + +Validate unique names only within the instance not in full scene + +___ + +
+ +### 🐛 **Bugfix** + +
+AY-6654 Look: Fix None values in collecting and applying attributes - #89 + + +This fixes a case where looks failed to apply due to `None` values being present in the collected attributes. +These will now be ignored in collected. There's an edge case where Maya returns `None` for string attributes that have no values set - those are captured now explicitly to just `""` to still collect and apply them later. + +Existing looks will now also apply correctly with `None` value in their look attributes, but the attributes with `None` values will be ignored with a warning. + +___ + +
+
+Fix settings for Maya USD Animation Extractor - #77 + + +Fix name in settings to match with name of plug-in to ensure settings are actually applied + +___ + +
+
+Improve applying render resolution and aspect ratio on render settings reset - #75 + + +Fix pixel aspect ratio / device aspect ratio getting messed up for Arnold renderer on render settings reset. + +Additionally: +- This now applies the resolution from the task entity, not the folder entity. +- This now also applies pixel aspect ratio as defined on the entity. + +___ + +
+
+Maya Scene exports do not default to including nodes that not children of members - #71 + + +On Maya scene exports only include the relevant history for the selected nodes downstream and upstream and not upstream, and also their downstream descendant children. + +___ + +
+ +### **Maintenance** + +
+Skip extraction of active view for automatic tests - #126 + +It seems that Maya UI is not completely visible or shutting down, `view.readColorBuffer` causes RuntimeError: (kFailure): Unexpected Internal Failure aas view is not visible. + +___ + +
diff --git a/tests/merged_pr_query.json b/tests/merged_pr_query.json index c39c973..777b1e4 100644 --- a/tests/merged_pr_query.json +++ b/tests/merged_pr_query.json @@ -35,7 +35,7 @@ "labels": [ { "id": "LA_kwDOMQ8b8s8AAAABqmH60w", - "name": "type: bug", + "name": "type: bugfix", "description": "Something isn't working", "color": "FFA696" }, @@ -56,7 +56,7 @@ "labels": [ { "id": "LA_kwDOMQ8b8s8AAAABqmH60w", - "name": "type: bug", + "name": "type: bugfix", "description": "Something isn't working", "color": "FFA696" } @@ -71,7 +71,7 @@ "labels": [ { "id": "LA_kwDOMQ8b8s8AAAABqmH60w", - "name": "type: bug", + "name": "type: bugfix", "description": "Something isn't working", "color": "FFA696" }, @@ -98,7 +98,7 @@ "labels": [ { "id": "LA_kwDOMQ8b8s8AAAABqmH60w", - "name": "type: bug", + "name": "type: bugfix", "description": "Something isn't working", "color": "FFA696" } diff --git a/tests/test_github_query.py b/tests/test_github_query.py index 1922ef0..c1d9195 100644 --- a/tests/test_github_query.py +++ b/tests/test_github_query.py @@ -32,6 +32,11 @@ def changelog_markdown() -> str: with open("formatted_changelog.md") as file: return file.read() +@pytest.fixture +def changelog_markdown_icons() -> str: + with open("formatted_changelog_icons.md") as file: + return file.read() + @pytest.fixture def changelog_body() -> str: with open("changelog.md") as file: @@ -86,12 +91,24 @@ def csv_string_no_comma() -> Literal['bugfix']: return "bugfix" @pytest.fixture -def csv_string_empty() -> Literal['']: +def empty_string() -> str: return "" @pytest.fixture def changelog_label_list() -> list[str]: - return ["type: enhancement", "type: bug", "type: maintenance"] + return ["type: enhancement", "type: bugfix", "type: maintenance"] + +@pytest.fixture +def label_with_emote() -> str: + return "type: bugfix(🐛)" + +@pytest.fixture +def label_type_prefix() -> str: + return "type: bugfix" + +@pytest.fixture +def changelog_label_list_icons() -> list[str]: + return ["feature(🎉)", "type: enhancement(💚)", "type: bugfix(🐛)", "type: maintenance"] @pytest.fixture def changelog_exclude_label_list() -> List[str]: @@ -132,9 +149,9 @@ def test_csv_string_to_list_no_comma(csv_string_no_comma: Literal['bugfix']) -> assert string_list == ["bugfix"] -def test_csv_string_to_list_empty(csv_string_empty: Literal['']) -> None: - string_list: List[str] = conversion_logic.csv_string_to_list(csv_string_empty) - string_list: List[str] = conversion_logic.csv_string_to_list(csv_string_empty) +def test_csv_string_to_list_empty(empty_string: Literal['']) -> None: + string_list: List[str] = conversion_logic.csv_string_to_list(empty_string) + string_list: List[str] = conversion_logic.csv_string_to_list(empty_string) assert string_list == [] @@ -222,7 +239,6 @@ def test_format_changelog_markdown(merged_pr_samples: List[dict[str, str]], chan filtered_pr_list: List[conversion_logic.Changelog] = conversion_logic.filter_changes_per_label(pr_data=merged_pr_samples, changelog_label_list=changelog_label_list) changelog_result: str = conversion_logic.format_changelog_markdown(changes=filtered_pr_list, changelog_label_list=changelog_label_list) - print(changelog_result) assert changelog_result == changelog_markdown def test_format_changelog_markdown_no_data(changelog_label_list: List[str]) -> None: @@ -230,3 +246,39 @@ def test_format_changelog_markdown_no_data(changelog_label_list: List[str]) -> N changelog_result: str = conversion_logic.format_changelog_markdown(changes=filtered_pr_list, changelog_label_list=changelog_label_list) assert changelog_result == "# Changelog\n" + +def test_filter_emote(label_with_emote: str) -> None: + filter_result: str = conversion_logic.filter_emote(text=label_with_emote) + + assert filter_result == "type: bugfix" + +def test_filter_emote_no_emote(label_type_prefix: str) -> None: + filter_result: str = conversion_logic.filter_emote(text=label_type_prefix) + + assert filter_result == "type: bugfix" + +def test_filter_emote_empty(empty_string: str) -> None: + filter_result: str = conversion_logic.filter_emote(text=empty_string) + + assert filter_result == "" + +def test_format_label_emote(label_with_emote: str) -> None: + formatted_label: str = conversion_logic.format_label(text=label_with_emote) + + assert formatted_label == "🐛 **Bugfix**" + +def test_format_label_empty(empty_string: str) -> None: + formatted_label: str = conversion_logic.format_label(text=empty_string) + + assert formatted_label == "" + +def test_format_label(label_type_prefix: str) -> None: + formatted_label: str = conversion_logic.format_label(text=label_type_prefix) + + assert formatted_label == "**Bugfix**" + +def test_format_changelog_markdown_icons(merged_pr_samples: List[dict[str, str]], changelog_label_list_icons: List[str], changelog_markdown_icons: str) -> None: + filtered_pr_list: List[conversion_logic.Changelog] = conversion_logic.filter_changes_per_label(pr_data=merged_pr_samples, changelog_label_list=changelog_label_list_icons) + changelog_result: str = conversion_logic.format_changelog_markdown(changes=filtered_pr_list, changelog_label_list=changelog_label_list_icons) + + assert changelog_result == changelog_markdown_icons From ca18b73bcae1fe159bb762841f6b3dba0775caf3 Mon Sep 17 00:00:00 2001 From: PhilNewm Date: Tue, 12 Nov 2024 11:29:04 +0100 Subject: [PATCH 2/3] Update action test run --- .github/workflows/action-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/action-ci.yml b/.github/workflows/action-ci.yml index a62df76..a1c591c 100644 --- a/.github/workflows/action-ci.yml +++ b/.github/workflows/action-ci.yml @@ -49,7 +49,7 @@ jobs: repo: "ynput/ayon-addon-action-testing" date: "2024-08-20T12:03:23Z" query_parameters: "body,labels,title,number,url,id" - changelog_labels: "feature,enhancement,bugfix,refactor,docs,test,pr" + changelog_labels: "feature(🎉),enhancement(💚),bugfix(🐛),refactor,docs,test,pr" - name: Show results run: | From 12bf248c466db8837736919ccbefbf4cd3c9dd93 Mon Sep 17 00:00:00 2001 From: PhilNewm Date: Tue, 12 Nov 2024 11:33:19 +0100 Subject: [PATCH 3/3] Update called branch --- .github/workflows/action-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/action-ci.yml b/.github/workflows/action-ci.yml index a1c591c..ea3633d 100644 --- a/.github/workflows/action-ci.yml +++ b/.github/workflows/action-ci.yml @@ -44,7 +44,7 @@ jobs: steps: - name: Run action id: test-action - uses: ynput/github-query@generate-changelog + uses: ynput/github-query@add-icons with: repo: "ynput/ayon-addon-action-testing" date: "2024-08-20T12:03:23Z"