library_registry in tests.

4 views
Skip to first unread message

Jan-Jaap Driessen

unread,
Dec 11, 2010, 11:59:01 AM12/11/10
to fans...@googlegroups.com
Running the js.jquery_tooltip tests with different command line
arguments leads to confusion:

`bin/py.test` runs the js.jquery_tooltip, js.jquery and fanstatic
tests. The fanstatic tests fail, because the foo package from the
fanstatic buildout is not available:

http://pastie.org/1368155

I try to exclude testing the js.jquery and fanstatic packages:

`bin/py.test js` runs the tests in the `js` directory only. We get the
following error:

http://pastie.org/1368162

`bin/py.test --ignore=src` is going to ignore the `src` directory,
where the `js.jquery` and `fanstatic` checkouts live. I get the same
error as above:

http://pastie.org/1368168

Looks like the library_registry kicks in before the entry point is loaded.

Any ideas?

JJ

Martijn Faassen

unread,
Dec 12, 2010, 11:01:38 AM12/12/10
to fans...@googlegroups.com
On 12/11/2010 05:59 PM, Jan-Jaap Driessen wrote:
> Running the js.jquery_tooltip tests with different command line
> arguments leads to confusion:
>
> `bin/py.test` runs the js.jquery_tooltip, js.jquery and fanstatic
> tests. The fanstatic tests fail, because the foo package from the
> fanstatic buildout is not available:
>
> http://pastie.org/1368155
>
> I try to exclude testing the js.jquery and fanstatic packages:

Right, I think this is the correct thing to do: pypy finds tests even in
stuff checked out by mr.developer, but we don't want to run them when
we're testing js.jquery_tooltip.

> `bin/py.test js` runs the tests in the `js` directory only. We get the
> following error:
>
> http://pastie.org/1368162
>
> `bin/py.test --ignore=src` is going to ignore the `src` directory,
> where the `js.jquery` and `fanstatic` checkouts live. I get the same
> error as above:
>
> http://pastie.org/1368168
>
> Looks like the library_registry kicks in before the entry point is loaded.
>
> Any ideas?

Looks like my entry point approach is leading to problems. I've altered
Fanstatic so that you need to call get_library_registry() to get the
global library registry to defer the entry point getting mechanism to
later during the initialization process. This fixes the tests.

Just running plain py.test fails still though, as some fanstatic tests
fail due to the missing MyPackage, as you had too. This problem would
decrease once we do a release of fanstatic and we can stop using
mr.developer here. Still, it's annoying.

If someone would want to look into it, we could investigate whether we
can put some tests in a different category with py.test, and the run
those *only* when you are testing Fanstatic itself, or something like
that. Or alternatively we could hide the test when MyPackage cannot be
imported.

Regards,

Martijn

Jan-Jaap Driessen

unread,
Dec 12, 2010, 1:54:05 PM12/12/10
to fans...@googlegroups.com
On Sun, Dec 12, 2010 at 5:01 PM, Martijn Faassen <faa...@startifact.com> wrote:
> On 12/11/2010 05:59 PM, Jan-Jaap Driessen wrote:
>>
>> Running the js.jquery_tooltip tests with different command line
>> arguments leads to confusion:
>>
>> `bin/py.test` runs the js.jquery_tooltip, js.jquery and fanstatic
>> tests. The fanstatic tests fail, because the foo package from the
>> fanstatic buildout is not available:
>>
>> http://pastie.org/1368155
>>
>> I try to exclude testing the js.jquery and fanstatic packages:
>
> Right, I think this is the correct thing to do: pypy finds tests even in
> stuff checked out by mr.developer, but we don't want to run them when we're
> testing js.jquery_tooltip.

[1] describes how to pass this information to setup.cfg. Is this the
way to go? If so, I will apply it to all packages.

>> `bin/py.test js` runs the tests in the `js` directory only. We get the
>> following error:
>>
>> http://pastie.org/1368162
>>
>> `bin/py.test --ignore=src` is going to ignore the `src` directory,
>> where the `js.jquery` and `fanstatic` checkouts live. I get the same
>> error as above:
>>
>> http://pastie.org/1368168
>>
>> Looks like the library_registry kicks in before the entry point is loaded.
>>
>> Any ideas?
>
> Looks like my entry point approach is leading to problems. I've altered
> Fanstatic so that you need to call get_library_registry() to get the global
> library registry to defer the entry point getting mechanism to later during
> the initialization process. This fixes the tests.
>
> Just running plain py.test fails still though, as some fanstatic tests fail
> due to the missing MyPackage, as you had too. This problem would decrease
> once we do a release of fanstatic and we can stop using mr.developer here.
> Still, it's annoying.
>
> If someone would want to look into it, we could investigate whether we can
> put some tests in a different category with py.test, and the run those
> *only* when you are testing Fanstatic itself, or something like that.  Or
> alternatively we could hide the test when MyPackage cannot be imported.

I fixed the 'mypackage' related failure in [2] using the pytest
skipping on missing import functionality [3].

> Regards,
>
> Martijn

1) http://pytest.org/example/pythoncollection.html#changing-directory-recursion
2) https://bitbucket.org/fanstatic/fanstatic/changeset/08ba03992f63
3) http://pytest.org/skipping.html#skipping-on-a-missing-import-dependency

Martijn Faassen

unread,
Dec 12, 2010, 2:29:12 PM12/12/10
to fans...@googlegroups.com
On 12/12/2010 07:54 PM, Jan-Jaap Driessen wrote:
> On Sun, Dec 12, 2010 at 5:01 PM, Martijn Faassen<faa...@startifact.com> wrote:
[snip]

>> Right, I think this is the correct thing to do: pypy finds tests even in
>> stuff checked out by mr.developer, but we don't want to run them when we're
>> testing js.jquery_tooltip.
>
> [1] describes how to pass this information to setup.cfg. Is this the
> way to go? If so, I will apply it to all packages.

Sure, if it works, sounds good!

[snip]


> I fixed the 'mypackage' related failure in [2] using the pytest
> skipping on missing import functionality [3].

I'm not sure whether we need to do this now that you uncovered [1], but
I guess it can't hurt! py.test does have lovely features, doesn't it? :)

Regards,

Martijn


Jan-Jaap Driessen

unread,
Dec 12, 2010, 3:07:51 PM12/12/10
to fans...@googlegroups.com
On Sun, Dec 12, 2010 at 8:29 PM, Martijn Faassen <faa...@startifact.com> wrote:
> On 12/12/2010 07:54 PM, Jan-Jaap Driessen wrote:
>>
>> On Sun, Dec 12, 2010 at 5:01 PM, Martijn Faassen<faa...@startifact.com>
>>  wrote:
>
> [snip]
>>>
>>> Right, I think this is the correct thing to do: pypy finds tests even in
>>> stuff checked out by mr.developer, but we don't want to run them when
>>> we're
>>> testing js.jquery_tooltip.
>>
>> [1] describes how to pass this information to setup.cfg. Is this the
>> way to go? If so, I will apply it to all packages.
>
> Sure, if it works, sounds good!

Done!

> [snip]
>>
>> I fixed the 'mypackage' related failure in [2] using the pytest
>> skipping on missing import functionality [3].
>
> I'm not sure whether we need to do this now that you uncovered [1], but I
> guess it can't hurt! py.test does have lovely features, doesn't it? :)

I am going to leave the skip-on-missing-mypackage-import in there,
because one day fanstatic may be part of a compattest, in which
mypackge may have not been set up.

Py.test indeed has lovely features.

> Regards,
>
> Martijn

Reply all
Reply to author
Forward
0 new messages