stuck on i18n-nulltranslations

Vincent Ladeuil vila+bzr at canonical.com
Fri Sep 9 14:20:56 UTC 2011


>>>>> Jonathan Riddell <jriddell at ubuntu.com> writes:

    > I'm stuck on a failure on this patch
    > https://code.launchpad.net/~jr/bzr/i18n-nulltranslations/+merge/72697

    > The patch reinstates gettext.NullTranslations in i18n to allow use
    > of i18n even when translations are not turned on, which I think is
    > an important first step to having full i18n.

    > However it fails on
    > bzrlib.tests.test_transport.TestTransport.test_transport_fallback


This test inherits from tests.TestCase which means it doesn't need any
file on disk.

    > but only when $LANGUAGE is not set, which seems to be the case on
    > PQM.

I keep forgetting the exact invocation but I think LC_ALL is set
instead ?

    > When $LANGUAGE is not set i18n.install() will load up the config
    > file

Beeeeep. You're not supposed to try to load a config file while in a
tests.TestCase

    > to check for a setting there (I think this is wrong, I think the
    > config file should override the environement variable but that's
    > for another patch.) 

I agree. This is one case where the env variables should be used to
provide default values if the user didn't mention anything else.

    > This seems to cause a circular error where UnsupportedProtocol
    > gets raised for the config file.

Well, the test clears all the protocol handlers and defines a single one
for a very specific purpose, trying to get any transport during this
test will fail.

    > So I don't know why this problem only affects my i18n-nulltranslations
    > patch in PQM, it should affect all. 

Because that's the only test that mutter() the error you're trying to
translate.

    > And I don't know how to fix it.

Well, since this test want to mutter(), it arguably needs to be able to
write to .bzr.log so it should not inherit from TestCase but from at
least from TestCaseInTempDir or even TestCaseWithTransport.

Then, since the transport factory is screwed, you probably want to
either:

- disable any translation,

or

- install them while the transport factory is not broken.


Overall, I'm a bit surprised you didn't encounter more cases like
that...

As far as tests are concerned, I'd be inclined to force the installation
of a null translation by default. Tests specific to the translation
should install their own anyway (and already ;).

  Vincent



More information about the bazaar mailing list