[RFC] Changes to 'selftest --starting-with'

Vincent Ladeuil v.ladeuil+lp at free.fr
Fri Aug 22 10:38:05 BST 2008


>>>>> "jam" == John Arbash Meinel <john.meinel at canonical.com> writes:

    jam> I've been using 'bzr selftest -s' a lot lately, and wanted to propose some
    jam> updates. For starters I'd like to say it has been great to use so far. Thanks
    jam> a lot to Vincent for implementing it. TDD is a lot easier when the
    jam> startup+run+teardown time is seconds rather than almost a minute.

    jam> There are a few small issues that I'd like to bring up:

That hasn't been forgotten :)

    jam> 1) Running 2 modules. For some commands I'd like to do something like:

    jam>   bzr selftest -s bzrlib.tests.test_command \
    jam>       -s bzrlib.tests.blackbox.test_command

    jam> aka, run both the blackbox tests and the direct tests. At the moment, I just
    jam> run it twice, which is ok. And I can do "foo ; blackboxfoo" so they chain but
    jam> it isn't quite as nice.

Ok.

    jam> 2) The prefixes are rather long.

True. And we lack an automatic completion mechanism (path
completion sounds very close though).

    jam> Having to type out 'bzrlib.tests.' all the time. I know
    jam> Vincent wanted to play with it a bit and see what worked
    jam> for him.

I'm still in the same state of mind but didn't the find the time
to actually implement it :D

    jam> My proposal would be to use something like:

    jam>  bzr selftest -s B.T.test_command

    jam> So the single capital letters would be used as abbreviations. The current
    jam> supported ones would be:
    jam>   B. => bzrlib.
    jam>   B.T. => bzrlib.tests.
    jam>   B.P. => bzrlib.plugins.
    jam>   B.T.B. => bzrlib.tests.blackbox.

    jam> I think that covers all the major prefixes. Obviously you can argue for stuff
    jam> like "B.T.BI. => bzrlib.tests.branch_implementations."

    jam> Another possible route is to make the whole thing an alias, and instead have:

    jam> BT. => bzrlib.tests.
    jam> BP. => bzrlib.plugins.
    jam> BTB. => bzrlib.tests.blackbox.

    jam> Either would be fine with me. Or if we wanted to do:

    jam> :BT. => bzrlib.tests.

    jam> To look something like the ":parent" that we use for
    jam> other aliases.

    jam> Anyone else have ideas?

I'd like to find a solution that do not conflict with valid
package names.

One is to use '.' as the leading character so that we can do:

.bt => bzrlib.tests
.bp => bzrlib.plugins
.gtk => bzrlib.plugins.gtk

i.e. a leading '.' is followed by an alias. How aliases are
defined is still to be addressed but I think pre-defining some
will cover most of the cases (at least for a start).

Being able to use path completion and an automatic translation
sounds fine too ('/' will never be a valid python package name,
at least I hope so :). 

99% of the time I type './bzr selftest ...' but others may have
other habits. So I wonder if the translation should take the
*current* working directory to interpret the path so that doing
'bzralias selftest ./blackbox' while the current dir is
bzrlib/tests will work too ?

   Vincent



More information about the bazaar mailing list