[Eric] Help Unit testing

Detlev Offenbach detlev at die-offenbachs.de
Tue Jun 26 18:04:26 BST 2007


On Montag, 25. Juni 2007, Cantoni Massimiliano wrote:
> Dear List users,
>
> I am working on the new version of Eric4 on my Gentoo Linux machine.
> I have already worked with Python using Eclipse PyDev but I found it
> elegant but not very responsive.
> I switched to Eric due to Python native implementation and QT4 features
> which I like very much.
> I like very much Eric features but now I am facing the following
> problem:
> My project directory structure is something like this:
>
> MyProjectRoot
> 	src
> 		mypackage
> 			mycode.py
> 			__init__.py
> 		__init__.py
> 	test
> 		mypackage
> 			__init.py
> 			mycodetestcase.py
> 		__init__.py
>
> Now if I run unittest from test/mypackage/mycodetestcase.py, it
> complains it does not find a class
> Defined in my src/package/mycode even if I used using
> src.mypackage.mycode import myclass.
>
> I think the reason is due to the fact UnitTest is using as working
> directory test/mypackage/...
> It is possible to add a working dir like MyProjectRoot to che
> enviroment?
>
> Am I doing something wrong?
>
> Could someone point me to the right direction?
>
> Thank you for your attention
>
> Massimiliano Cantoni
>
>
>
> _______________________________________________
> Eric mailing list
> Eric at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/eric

In your initialization routine you could add the path to src to sys.path.

import sys
sys.path.insert(0, <path_to_src>)

Detlev
-- 
Detlev Offenbach
detlev at die-offenbachs.de


More information about the Eric mailing list