[Grok-dev] Re: z3c.testsetup 0.2.3 released
uli at gnufix.de
Thu Jun 26 06:52:56 EDT 2008
Wolfgang Schnerring wrote:
> * Uli Fouquet <uli at gnufix.de>[2008-06-25 18:07]:
> > I just did a quick bugfix release 0.2.3 which should fix this error
> That did the trick, z3c.testsetup now works as advertised. Thanks! :-)
Fine, that it works at least a bit better :-)
> I would have liked to put the register_all_tests() call into __init__.py, but
> this failes with
> Traceback (most recent call last):
> File "myproject/build/eggs/martian-0.10-py2.4.egg/martian/scan.py", line 192, in resolve
> AttributeError: 'module' object has no attribute 'test'
> Is this a shortcoming of martian or inherently impossible? (My Python-fu is not
> strong enough to answer that)
I ran into this too. This happens while collecting packages and modules
for test registration.
martian.scan creates in certain circumstances ModuleInfos for which it
refuses to deliver the accompanied module. I have to look deeper into
it. It is annoying me too ;-)
There might, however, be a good reason for it: when you request to get a
module which is currently processed, then it might be impossible to load
it. It would be like creating sample/mod.py and then, in mod.py, saying
`from sample import mod`. This would mean trouble (infinite recursion).
Therefore most probably martian.scan is not to blame.
But as it annoys me too, I'll fix that very shortly. It should be only a
little fix. So thanks for putting it on the agenda!
>  an aside: is there a (quick) way to say "this package"? __name__ is not a
> full dotted name and so won't work,
It is not? Normally, I would say
should do the trick, but on a module level. If you need it in an object,
you might get the dotted module path from self.__module__.
For z3c.testsetups you normally operate on module level, so there you
should be able to do::
test_suite = z3c.testsetup.register_all_tests(
to register the package you're in. But I don't know how PEP-compatible
> and a PEP for __module__ was rejected as far
> as I can see. Not having to explicitly type the package name would be really
> nice, though...
Right, interesting! Which PEP was it?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 191 bytes
Desc: Dies ist ein digital signierter Nachrichtenteil
Url : http://mail.zope.org/pipermail/grok-dev/attachments/20080626/8e6c83a3/attachment.bin
More information about the Grok-dev