Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dessert fails when importing pendulum 3.0.0 #25

Open
LiadOz opened this issue May 27, 2024 · 0 comments
Open

Dessert fails when importing pendulum 3.0.0 #25

LiadOz opened this issue May 27, 2024 · 0 comments

Comments

@LiadOz
Copy link

LiadOz commented May 27, 2024

When attempting the following:

with dessert.rewrite_assertions_context():
    emport.import_file("path/to/pendulum/date.py")

dessert fails with:

  File "/Users/loz/terrible/python_ten/ten_env/lib/python3.10/site-packages/pendulum/helpers.py", line 51, in <module>
    difference_formatter = DifferenceFormatter()
  File "/Users/loz/terrible/python_ten/ten_env/lib/python3.10/site-packages/pendulum/formatting/difference_formatter.py", line 18, in __init__
    self._locale = Locale.load(locale)
  File "/Users/loz/terrible/python_ten/ten_env/lib/python3.10/site-packages/pendulum/locales/locale.py", line 41, in load
    raise ValueError(f"Locale [{locale}] does not exist.")

I bet it's related to the following code that did not exist in the previous pendulum version:

        locale_path = cast(Path, resources.files(__package__).joinpath(actual_locale))

Full context:

class Locale:

   ...

    @classmethod
    def load(cls, locale: str | Locale) -> Locale:
        if isinstance(locale, Locale):
            return locale

        locale = cls.normalize_locale(locale)
        if locale in cls._cache:
            return cls._cache[locale]

        # Checking locale existence
        actual_locale = locale
        locale_path = cast(Path, resources.files(__package__).joinpath(actual_locale))
        while not locale_path.exists():
            if actual_locale == locale:
                raise ValueError(f"Locale [{locale}] does not exist.")

EDIT: It seems that it works for python3.9 but fails in 3.10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant