[Grok-dev] Re: where do I put doctests for my models?

Tres Seaver tseaver at palladion.com
Wed Aug 8 00:12:09 EDT 2007


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

Martijn Faassen wrote:
> Brandon Craig Rhodes wrote:
> [snip discussion about what the appropriate level of magic is]
> 
> I agree that some automation for tests would be useful.
> 
>> The rule that "./bin/test runs, as a doctest, every .txt file that it
>> can find under your app/ directory" would be, to me, exactly the same
>> kind of magic that Grok already provides for modules.  It would
>> confuse me - in fact, it did confuse me! - when the first .txt files I
>> added to my application were not auto-discovered by "./bin/test",
>> because I had assumed that everything in Grok would follow the same
>> rule: a recursive descent of my modules directories, looking for
>> things to process.
> 
> Unless we can find a way to contain within the .txt file instructions on 
> the testing strategy to take (unit test, functional test, what values to 
> set up in a glob, etc), just picking up .txt files seems a bit too 
> aggressive to me. In particular setting up global names to use in the 
> doctest is quite common and somewhat difficult to do from within the 
> doctest itself.

I actually dislike that practice:  the "majyk" globals detract from the
readability of the test, much like the names imported using 'from foo
import *'.  Better to have an explict call to a function which gives you
back a tuple / mapping which you then bind within the doctest.


Tres.
- --
===================================================================
Tres Seaver          +1 540-429-0999          tseaver at palladion.com
Palladion Software   "Excellence by Design"    http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGuUKZ+gerLs4ltQ4RAvHXAJ4rg34dCYiwexWos6SSDEa+GKnyxQCeIdWY
2YJaIGJlH2u38kFoVzazVqU=
=M/C8
-----END PGP SIGNATURE-----



More information about the Grok-dev mailing list