You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by jl...@apache.org on 2026/09/24 00:04:08 UTC

(superset) branch ultraset-fix-44551-2 updated: test(i18n): locate the sk catalog relative to the test file

This is an automated email from the ASF dual-hosted git repository.

sadpandajoe pushed a commit to branch ultraset-fix-44551-2
in repository https://gitbox.apache.org/repos/asf/superset.git


The following commit(s) were added to refs/heads/ultraset-fix-44551-2 by this push:
     new c91ee9c781a test(i18n): locate the sk catalog relative to the test file
c91ee9c781a is described below

commit c91ee9c781a3ec4283f633377a603a8d0b03c834
Author: Joe Li <47...@users.noreply.github.com>
AuthorDate: Thu Sep 24 00:03:55 2026 +0000

    test(i18n): locate the sk catalog relative to the test file
    
    The regression test resolved the catalog through a bare relative path, so
    it only worked when pytest was invoked from the repository root. polib
    treats an unreadable path as inline .po content, so from any other working
    directory the test failed with a misleading "Syntax error in po file
    (line 1)" instead of finding the catalog.
    
    Resolve the path from __file__, matching
    tests/unit_tests/scripts/translations/backfill_po_test.py.
    
    Co-Authored-By: Claude Opus 5 <no...@anthropic.com>
---
 .../translations/sk_sql_lab_progress_message_test.py          | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/tests/unit_tests/translations/sk_sql_lab_progress_message_test.py b/tests/unit_tests/translations/sk_sql_lab_progress_message_test.py
index cebecc8f1a8..74b9696f86a 100644
--- a/tests/unit_tests/translations/sk_sql_lab_progress_message_test.py
+++ b/tests/unit_tests/translations/sk_sql_lab_progress_message_test.py
@@ -26,9 +26,18 @@ formatting it, and every SQL Lab query fails in that locale.
 """
 
 import re
+from pathlib import Path
 
 import polib  # type: ignore[import-untyped]
 
+_SK_CATALOG = (
+    Path(__file__).resolve().parents[3]
+    / "superset"
+    / "translations"
+    / "sk"
+    / "LC_MESSAGES"
+    / "messages.po"
+)
 _MSGID = "Running block %(block_num)s out of %(block_count)s"
 _PLACEHOLDER_RE = re.compile(r"%\((\w+)\)s")
 
@@ -38,7 +47,7 @@ def _placeholder_names(text: str) -> set[str]:
 
 
 def test_sk_progress_message_placeholders_match_source() -> None:
-    catalog = polib.pofile("superset/translations/sk/LC_MESSAGES/messages.po")
+    catalog = polib.pofile(str(_SK_CATALOG))
     entry = catalog.find(_MSGID)
 
     assert entry is not None, f"msgid not found in sk catalog: {_MSGID!r}"