[Zope-Coders] Help with Unit Testing: safe imports

Tres Seaver tseaver@zope.com
19 Aug 2002 09:31:45 -0400


On Mon, 2002-08-19 at 09:18, Jeremy Hylton wrote:
> >>>>> "CD" == Casey Duncan <casey@zope.com> writes:
> 
>   CD> We need a unit testing "Best Practices" wiki or something. This
>   CD> is making my brain hurt ;^)
> 
> I can't even remember why the import isn't at the module level.  It
> seems like the most natural choice.
> 
> With test.py (Zope 3 / StandaloneZODB), if there is an error during
> module import, it prints a traceback and continues.  If you use the -d
> flag, it will fail on the ImportError.

Python's own 'unittest.py' fails silently if the test module bails with
import errors.

Successful import of the module-under-test should *not* be assumed by
the test module..

Tres.
-- 
===============================================================
Tres Seaver                                tseaver@zope.com
Zope Corporation      "Zope Dealers"       http://www.zope.com