From d0c78f27ee37a5cbe9aea812725f8bf5c350732d Mon Sep 17 00:00:00 2001 From: Irtaza Akram Date: Tue, 7 Jan 2025 15:51:48 +0500 Subject: [PATCH] fix: test issues --- xmodule/modulestore/django.py | 5 +++-- xmodule/modulestore/tests/test_django_utils.py | 2 +- xmodule/x_module.py | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/xmodule/modulestore/django.py b/xmodule/modulestore/django.py index 3b3666ac5ebe..1a5a37963735 100644 --- a/xmodule/modulestore/django.py +++ b/xmodule/modulestore/django.py @@ -9,7 +9,7 @@ import gettext import logging -from importlib.resources import files +from importlib.resources import path import re # lint-amnesty, pylint: disable=wrong-import-order from django.conf import settings @@ -422,7 +422,8 @@ def get_python_locale(self, block): return 'django', xblock_locale_path # Pre-OEP-58 translations within the XBlock pip packages are deprecated but supported. - deprecated_xblock_locale_path = str(files(xblock_module_name) / 'translations') + deprecated_xblock_locale_path = str(path(xblock_module_name, 'translations')) + # The `text` domain was used for XBlocks pre-OEP-58. return 'text', deprecated_xblock_locale_path diff --git a/xmodule/modulestore/tests/test_django_utils.py b/xmodule/modulestore/tests/test_django_utils.py index 6479ef1b0fb1..32fc5fbf18db 100644 --- a/xmodule/modulestore/tests/test_django_utils.py +++ b/xmodule/modulestore/tests/test_django_utils.py @@ -23,7 +23,7 @@ def test_get_python_locale_with_atlas_oep58_translations(mock_modern_xblock): assert domain == 'django', 'Uses django domain when atlas locale is found.' -@patch('xmodule.modulestore.django.resource_filename', return_value='/lib/my_legacy_xblock/translations') +@patch('xmodule.modulestore.django.path', return_value='/lib/my_legacy_xblock/translations') def test_get_python_locale_with_bundled_translations(mock_modern_xblock): """ Ensure that get_python_locale() falls back to XBlock internal translations if atlas translations weren't pulled. diff --git a/xmodule/x_module.py b/xmodule/x_module.py index 3df98808169d..30e3b218cc81 100644 --- a/xmodule/x_module.py +++ b/xmodule/x_module.py @@ -884,7 +884,7 @@ def get_template_dirpaths(cls): custom_template_dir = cls.get_custom_template_dir() if custom_template_dir: template_dirpaths.append(custom_template_dir) - return template_dirpaths + return [str(td) for td in template_dirpaths] @classmethod def get_custom_template_dir(cls):