[Grok-dev] Re: failing (security?) tests on grok trunk

Philipp von Weitershausen philipp at weitershausen.de
Fri Aug 24 07:43:05 EDT 2007

Jan-Wijbrand Kolman wrote:
> Jan-Wijbrand Kolman wrote:
>> Martijn Faassen wrote:
>>> Hi there,
>>> Latest grok trunk, buildout -n gives me two test failures:
>> snip
>> Weird - I'll look at it rightaway.
> It's still weird; I was pretty sure all tests passed just before I did 
> the Role/Permission checkin. And I *cannot* reproduce the failures right 
> now, with a clean checkout and doing a ./bin/buildout -n before issueing 
> ./bin/test...
> What happens if you explicitly make the permission title a unicode 
> string (as might actually be the proper way anyway)?

At first I coudln't reproduce this either. What struck me as peculiar, 
however, was the fact that the grok.ftests.security.grant test fails, 
but this 'Painting Owner' role (it's a *role*, not a permission) on 
which it's failing is defined somewhere else.

What we have here, gentlemen, is an ordering issue. I renamed roles.py 
to aaaaroles.py (and adjusted the grok.grok() line in the doctest 
accordingly). Sure enough I saw Martijn's failure.

There are two issues at hand here:

First, the obvious issue is that the DefineRoleGrokker doesn't adhere to 
the IRole interface which mandates that 'title' must be unicode. In 
grok, we've adopted the policy that ASCII strings are absolutely okay 
when unicode is normally required (byte strings aren't accepted, 
obviously). If you look at the DefinePermissionGrokker, it handles this 
very case by unicode()ing the title. I've added the same thing for the 
DefineRoleGrokker now.

The second issue is that we have poor ftest isolation. This is actually 
an oxymoron because ftests typically are *not* isolated, but in turn 
they don't do their own setup either. They rely on the layer's setup and 
run within that. Our ftests do do their own setup (by calling 
grok.grok()) all the time. This way, we can get to the ordering problems 
  we've just seen.

I think that the layer should grok.grok() the whole grok.ftests package, 
therefore setting up *all* the test fixtures at once. That way we'll 
*always* notice when we have conflicting test fixtures, not just when 
Martijn runs the tests ;).

I've started a branch called 'philikon-ftest-layer-does-fixture-setup' 
to work on this.

http://worldcookery.com -- Professional Zope documentation and training

More information about the Grok-dev mailing list