[Grok-dev] grok.testing.grok_component problems

Martijn Faassen faassen at startifact.com
Tue Nov 20 06:12:10 EST 2007


Hi there,

After the actions refactoring, the following pattern doesn't work 
anymore in doctests:

   >>> import grok.testing
   >>> class Foo(grok.Adapter):
   ...     stuff here
   >>> grok.testing.grok_component('Foo', Foo)

It fails with the following error:

[snip]
       File 
"/home/faassen/buildout-eggs/grok-0.11-py2.4.egg/grok/testing.py", li
ne 32, in grok_component
         module_info = scan.module_info_from_dotted_name(obj_module)
       File 
"/home/faassen/buildout-eggs/martian-0.9.1-py2.4.egg/martian/scan.py"
, line 130, in module_info_from_dotted_name
         return ModuleInfo(module.__file__, dotted_name, exclude_filter)
     AttributeError: 'module' object has no attribute '__file__'

This is because the module that is passed in is __builtin__, which has 
no attribute __file__.

What can we do about this? This is an essential use case for 
grok_component. It's really nice to be able to register adapters in 
tests like that.

Regards,

Martijn



More information about the Grok-dev mailing list