doctesting

belinda thom bthom at cs.hmc.edu
Tue Jan 2 03:26:13 EST 2007


Hi,

I'd like to write a tester script that I can place in one place (say  
~/bin/python/tester.py) and then have it visible to me at the cmd- 
line (by setting the path  variable appropriately). I have had no  
luck in getting it to work, however.

It appears like the doctest code itself assumes that all modules to  
be imported lie in some directory other than the one I invoked the  
tester.py script from. In particular, simple imports in a .txt file  
like:

   >>> import foo

fail even though I've started the script in a directory that contains  
file foo.py

I only achieve success when I manually copy tester.py into this same  
directory (symlinks don't fix the problem).

This is a real drag b/c it means I have to copy this tester.py  
routine into _every_ directory that contains a .txt python unit test  
file. From a code-reuse point of view, this is pretty hideous...

Advice appreciated,

--b



More information about the Python-list mailing list