Slow tests

Martin Pool mbp at canonical.com
Fri Sep 18 03:03:23 BST 2009


2009/9/18 Harald Meland <harald.meland at usit.uio.no>:
> [Martin Pool]
>> I'm talking about a case like this:
>>
>> """Hi Harald, what happens with an
>> assert statement
>> on a line within a triple-quoted string?"""
>>
>> You probably can write a regexp to match it, but I'm not sure it matters.
>
> I wouldn't want to write a regexp catching that case; I'd rather keep
> the regexp simple, let it give a false positive on things like the
> above example, pass the file it appears in on to the AST processing,
> and let that decide whether there actually was any assert statements
> in the file.
>
> The difference between the simple and the more complex regexp becomes
> clear when you have a line like this:
>
>    # assert foo < bar
>
> The simple regexp will treat this as a potential assert statement, so
> the file will be passed on to the AST processing.  The more complex
> regexp, however, will *not* match on that line, so AST processing of
> the corresponding file can be avoided.
>
>
> I think we may be talking past each other; the merge I've proposed is
> quite small, and as I've said, we can get back to discussing the
> merits of using more complex regexps once people have had a look at
> the simple one.

It's ok, I looked at your mp after reading this, and saw you use the
AST only as a fallback if the regexp matches, which was very clever.
+1 from me.

(Actually, this falls back to something slow, which generally we want
to avoid, but in this case I think it's fine.)

-- 
Martin <http://launchpad.net/~mbp/>



More information about the bazaar mailing list