[Tutor] unittest problem

Guillermo Fernandez Castellanos guillermo.fernandez at epfl.ch
Wed Mar 3 07:28:02 EST 2004


hi,

> Conceptually, this is saying that the 'test' module depends on those four
> modules.  But test_begohandler and test_statemachine themselves depend on
> 'test'.  This is called a 'circular dependency', and is not usually a good
> idea.
> The easiest way to fix it is to break the circularity.  I see that
> test_begohandler and test_statemachine only care about test.Base, so you
> can split off test.Base off into a separate module --- call it 'base.py'.
> Then test_begohandler and test_statemachine only need to import 'base',
> not 'test', and so we avoid the circularity issue.
> Does this make sense?  Good luck to you!
Makes lot's of sens. Thanks!

I solved it in a slightly different way though, by moving the imports that 
where doing the circular reference later (after the definition of Base class) 
so they would knew what test.Base was.

Thanks a lot!

Guille



More information about the Tutor mailing list