[Grok-dev] Get default directive

Paul Wilson paulalexwilson at gmail.com
Tue Jan 5 07:19:01 EST 2010

2010/1/5 Paul Wilson <paulalexwilson at gmail.com>:
> Hi there,
> As part of my Manuel fakemodule integration into martian, I've been
> looking at the martian 'get_default' stuff that's been worked on
> recently. As a reminder, the code searches a component's MRO to find
> module directives that might apply to its parents. One thing that I've
> noticed is that many classes inherit from 'object' at the top of their
> inheritance tree, which causes martian to scan __builtin__ for
> directives. I think its quite safe to check if the module is
> __builtin__ and skip it -- this would save a bit of time and, more
> importantly, allow all tests to pass on my martian branch ;-)

Also, context.txt contains the following test:

----------------- %< ------------------
There are too many possible contexts::

  >>> class ambiguouscontext(FakeModule):
  ...   class A(Context):
  ...     pass
  ...   class B(Context):
  ...     pass
  ...   class C(object):
  ...     pass
  >>> from martiantest.fake import ambiguouscontext
  >>> context.bind(get_default=get_default_context).get(ambiguouscontext.B)
  Traceback (most recent call last):
  GrokError: Multiple possible contexts for <class
'martiantest.fake.ambiguouscontext.B'>, please use the 'context'
----------------- %< ------------------

Shouldn't this be...


?? I was assuming that A and B were the ambiguous contexts, and C is
the subject from which we should be deriving the context. Strangely,
this test passes on trunk, but fails with my fake module version....


More information about the Grok-dev mailing list