[Freeipa-devel] [PATCH 68] text unit test should validate using installed mo file

Petr Viktorin pviktori at redhat.com
Wed Mar 28 08:40:36 UTC 2012


On 03/27/2012 10:31 PM, John Dennis wrote:
> On 03/27/2012 01:57 PM, Petr Viktorin wrote:
>> Seeing this, I definitely recommend putting po_file_iterate in an
>> importable package.
>
> Of course I considered that. Clearly not any existing top level
> directory in the tree, those are reserved for what we install and what
> is "import visible" after installation.
>
> Test utility code should not be installed with our normal modules and
> packages.
>
> It has to be importable from both the install/po area and the test area.
>
> It can't depend on nosetests setting the import path prior to execution
> (because only the unit tests are run via nose).
>
> So we could create a directory tests/util which hosts utilities used for
> test code and locate it there. I did consider that, it would be
> (somewhat) cleaner.
>
> But unless I'm missing something someone is going to have to modify the
> include path prior to importing any test utility code. It just becomes a
> question of where the file is located. I'd be happy to move the bulk of
> the logic into tests/util/i18n.py, but to import it the importing code
> is going to have to add tests/util to the import path, which puts you
> pretty much back into the original situation, just with a different path
> (albeit perhaps a more logical cleaner path).

Can install/po/Makefile just call test_i18n.py from the tests/ tree? It 
doesn't import any IPA code so there's no need to set sys.path in this 
case (though there'd have to be a comment saying we depend on this).
In the other case, unit tests, the path is already set by Nose.
Also the file would have to be renamed so nose doesn't pick it up as a 
test module.


-- 
Petr³




More information about the Freeipa-devel mailing list