How to organize test cases with PyUnit

Aahz aahz at pythoncraft.com
Thu Jul 11 13:49:11 EDT 2002


In article <roy-F91625.14520007072002 at reader2.panix.com>,
Roy Smith  <roy at panix.com> wrote:
>
>BTW, I started out with the test cases in a "test" subdirectory, and ran 
>into a slight uglyness.  My initial idea was to just have module-test.py 
>do an "import ../module", until I discovered that gives you a syntax 
>error.  I can get around it with:
>
>import sys
>sys.path.insert (1, '..')
>import module
>
>but that seems clumsy.  Is there a cleaner way to do that?

Keeping in mind that I don't actually have any experience with this, I'd
make your test directory a package and include a driver script with your
main modules.  Then the driver script only needs to import from the
package.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

Project Vote Smart: http://www.vote-smart.org/



More information about the Python-list mailing list