[PATCH] test: remove dependency on $PYTHONDIR

Durham Goode durham at fb.com
Fri Feb 19 13:01:44 EST 2016






On 2/18/16, 8:11 PM, "timeless.bmo1 at gmail.com on behalf of timeless" <timeless.bmo1 at gmail.com on behalf of timeless at gmail.com> wrote:

>Durham Goode wrote:
>> I understand the frustration with fixing glob'd lines, but won't these lines
>> need manual fixing even with the $PYTHONDIR change? Because the line number
>> is glob'd?
>
>The line number wouldn't need to be globbed, but if it's globbed, then
>there shouldn't be a change.
>
>The problem is the combination of the line changing and the file path
>not matching and needing to be reglobbed.

I don't understand.  Currently the lines are:

$PYTHONDIR/mercurial/util.py:* in check (glob)


Previously they were:

*/mercurial/util.py:* in check (glob)


In both cases, the only time you need to worry about -i is if the stack changes (a new stack entry, or the removal of one).  In both cases, using -i will un-glob the the line number and require you to do manual re-globbing, just like you would have to do for the PYTHONDIR before.  So I'm not sure I see PYTHONDIR actually saving much effort, aside from a few vim key strokes to replace the path with a *.

You could say we shouldn't glob the line numbers, but having hard coded line numbers in our tests seems like an even worse practice, since then the test would fail every time you edit dispatch/util/etc.

>
>> Perhaps, instead of hard coding $PYTHONDIR in the tests, you could
>> post-process the -i output, and replace any occurrence of the python
>> directory path with a glob and add (glob) at the end of the line.
>
>Would this do the right thing for your system? (I'm not sure I care,
>but since that is what caused you to change things, I want to
>understand it better)
>And is the path here a set of paths, or a single directory-path?

Nope, this wouldn't work for us.  But I'm fine manually fixing globs every now and then if it just affects us.


More information about the Mercurial-devel mailing list