Skip to content

Commit

Permalink
fix: test issues
Browse files Browse the repository at this point in the history
  • Loading branch information
irtazaakram committed Jan 7, 2025
1 parent 583ec83 commit d0c78f2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions xmodule/modulestore/django.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion xmodule/modulestore/tests/test_django_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion xmodule/x_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit d0c78f2

Please sign in to comment.