I think the tests should check whether the needed locale is available. While I suppose relying on en_US.UTF-8 is pretty reasonable for the time being, many Gentoo users don't have German locales they're never going to use installed.
======================================================================
ERROR: test_use_locale_context_manager (tests.test_xpath_token.XPath1TokenTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/tmp/portage/dev-python/elementpath-2.1.0/work/elementpath-2.1.0/tests/test_xpath_token.py", line 185, in test_use_locale_context_manager
with token.use_locale('de_DE.UTF-8'):
File "/usr/lib/pypy3.7/lib-python/3/contextlib.py", line 112, in __enter__
return next(self.gen)
File "/tmp/portage/dev-python/elementpath-2.1.0/work/elementpath-2.1.0/elementpath/xpath_token.py", line 584, in use_locale
raise self.error('FOCH0002', 'Unsupported collation %r' % collation) from None
elementpath.exceptions.ElementPathLocaleError: [FOCH0002] Unsupported collation 'de_DE.UTF-8'
======================================================================
ERROR: test_use_locale_context_manager (tests.test_xpath_token.XPath2TokenTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/tmp/portage/dev-python/elementpath-2.1.0/work/elementpath-2.1.0/tests/test_xpath_token.py", line 185, in test_use_locale_context_manager
with token.use_locale('de_DE.UTF-8'):
File "/usr/lib/pypy3.7/lib-python/3/contextlib.py", line 112, in __enter__
return next(self.gen)
File "/tmp/portage/dev-python/elementpath-2.1.0/work/elementpath-2.1.0/elementpath/xpath_token.py", line 584, in use_locale
raise self.error('FOCH0002', 'Unsupported collation %r' % collation) from None
elementpath.exceptions.ElementPathLocaleError: [err:FOCH0002] Unsupported collation 'de_DE.UTF-8'
I'm sorry, it was an oversight, I've already other tests with the proper protection in case of locale error.
I've just published a new release containing a fix for this.
I think the tests should check whether the needed locale is available. While I suppose relying on
en_US.UTF-8
is pretty reasonable for the time being, many Gentoo users don't have German locales they're never going to use installed.