location of non-test test code

John Arbash Meinel john at arbash-meinel.com
Tue Jul 18 16:14:00 BST 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Martin Pool wrote:

>> By the way, what do people think about making our current regex match be
>> case insensitive? I've taken to doing:
>>
>> bzr selftest -v "(?i)http"
>>
>> Which sets the insensitive flag in the regex engine, but it isn't a very
>> nice thing to always have to type.
> 
> That sounds reasonable.  Is it more for ease of typing, or so that you
> can match both classes and modules?

It is because some tests are adapted and have foo(HttpTransport), and
other tests are direct and have 'test_http.test_foo'.

By using case insensitivity, I get *all* of the http tests. (especially
true for sftp, where I believe we have 'sftp', 'Sftp' and 'SFTP'.

...

> I'd classify it as 
> 
> bzrlib.tests - actual test code
> 
> bzrlib.testsupport - code that's not actually a test, but used only
>     while testing (e.g.  instrumented classes).  If they only apply to one
>     test module, they should probably just be in there.

Would this also mirror the source tree? And what would they be called.
Or would it just be like our current naming (semi-random :)
bzrlib/testsupport/encodingadapter.py
bzrlib/testsupport/lockhelper.py
etc.

> 
> bzrlib.selftest - root test classes - TestCase, etc
> 
> bzrlib.selftest - command-line selftest stuff, specific to our command line and output  
>    format.  If anything deserveds bzrlib.selftest it's probably this.
> 
> I'm not set on those names.
> 
> On the whole I like just buttedtogether words rather than
> underscore_joined in filenames, with 'test_' as a special prefix.
> 
> Separately I'd suggest to move all the transport servers into
> bzrlib.server.*, parallel to the transport clients.

I would appreciate that.

> 
> It would also be nice to just scan the library for tests, rather than
> making them be listed in tests/__init__.  This must have been written
> many times in Python, so perhaps we can lift it from somewhere though I
> suppose it's pretty trivial.

Also much nicer than the current method. Since we are just using strings
anyway, why not just do a os.listdir(os.path.dirname(__file__)), and
grab everything that starts with 'test'? I'm not sure that it needs to
be lifted from elsewhere. Though I think twisted does it, so we could
use it as a reference.

> 
> I've noticed that reviewing patches is harder when there are many
> classes in the same file, as Python doesn't give you much context to
> which class was modified.
> 

Agreed.

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFEvPq3JdeBCYSNAAMRAmNlAJ430W7TPrVgA7ruNdbQs8ntW98VWQCfUdeP
R+i1MIU20MOUCrTDbU4yqpQ=
=pqL0
-----END PGP SIGNATURE-----




More information about the bazaar mailing list