[TIP] Testing locale-dependent behaviour
thomas at thomas-lotze.de
Mon Nov 24 22:42:29 PST 2008
Is there a best practice how to test locale-dependent code, given that one
cannot be sure when writing the tests which locales are available on the
machines that may execute them later? Is there any way to define a locale
from inside a test environment in order to achieve some specific behavior
to test for?
As an example, I want to be able to check that a function that calls
str.upper at some point behaves differently under a locale that knows
about umlauts than under the C locale, but the tests may get executed on a
machine that doesn't have any umlaut-aware locales.
More information about the testing-in-python