[py-dev] Import errors

Ian Bicking ianb at colorstudy.com
Sat Apr 23 03:45:27 MEST 2005


holger krekel wrote:
> Hi Ian, 
> 
> On Thu, Apr 21, 2005 at 22:38 -0500, Ian Bicking wrote:
> 
>>Well, I'm doing a big renaming, and the errors from bad imports are a 
>>bit confusing.  It seems whenever there's an import error, the module 
>>with the error still gets loaded, but is empty.  This is a bit confusing 
>>to debug.  Well, this isn't true in the test_* module, but in the 
>>modules they import.
> 
> 
> are you using a recent version of the py lib?  
> 
> py.test at least shouldn't trigger any special imports 
> anymore but uses the underlying import mechanism.  
> 
> Could you post one of the offending tracebacks? 

To repeat:

$ svn co http://codespeak.net/svn/user/ianb/py_test_import_failure
A  py_test_import_failure/import_fails.py
A  py_test_import_failure/test_import_fail.py
Checked out revision 11048.
$ cd py_test_import_failure/
py_test_import_failure$ py.test
inserting into sys.path: /home/ianb/py/dist
============================ test process starts 
============================
testing-mode: inprocess
executable:   /usr/bin/python  (2.3.5-final-0)

py_test_import_failure/test_import_fail.py[-1] F
_____________________________________________________________________________

     def test_this():
E       assert import_fails.a == 1
 >       AttributeError: 'module' object has no attribute 'a'

[/home/ianb/t/py_test_import_failure/test_import_fail.py:4]
[modulepath: test_this]
_____________________________________________________________________________
================= tests finished: 1 failed in 0.02 seconds =================

-- 
Ian Bicking  /  ianb at colorstudy.com  / http://blog.ianbicking.org


More information about the py-dev mailing list