[py-dev] improving unittest support (was: Re: Running Django unittests using py.test)

holger krekel holger at merlinux.eu
Thu Nov 4 13:35:49 CET 2010


Hi Morten,

On Tue, Nov 02, 2010 at 10:11 +0100, Morten Brekkevold wrote:
> On Mon, Nov 01, 2010 at 11:19:30PM +0100, holger krekel wrote:
>  
> > > Django's TestCase class hooks into this by overriding
> > > unittest.TestCase.__call__(), and adds pre_setup and post_teardown hooks as
> > > well.  Since py.test never uses TestCase instances as callables, Django
> > > fixtures are never loaded and these tests fail.
> > 
> > right.
> >  
> > > I'm not familiar with the inner workings of py.test, so my question is: Is
> > > this behavior intentional? If not, can we change it?
> > 
> > It is intentional but we can (try to) change it :)
> 
> As long as the mentioned internal separation of the phases won't be a
> problem. I'm sure you know best :)

Let's hope so :)
 
> > > (this can be reproduced using http://dpaste.com/hold/268698/ - which doesn't
> > > require Django, it just rips off Django's TestCase code)
> > 
> > Thanks for providing the paste and your precise helpful info. 
> 
> No prob, I wrote that just to satisfy my curiosity.  Didn't want to start
> tinkering with py.test code without knowing what I was doing, though.

I am very interested in feedback and co-hacking on unittest support,
specifically.  I am not using unittest based test suites/cases myself
so i depend on support and "registered interest" on that front.

> > As it happens i am in the process of preparing a pytest-2.0 and just
> > went ahead and changed the unittest-plugin to invoke the test case
> > as you described.  This lets your example run.   
> 
> Wow, that was fast :-)
> 
> >     pip install -i http://pypi.testrun.org pytest
>  
> > Does this work better for you?
> 
> Definitely.  All tests pass with flying colors now, thank you very much.  Is
> there an ETA on a 2.0 release?

By end next week i plan to have at least a 2.0 beta out.

best,
holger


> -- 
> mvh
> Morten Brekkevold
> UNINETT
> _______________________________________________
> py-dev mailing list
> py-dev at codespeak.net
> http://codespeak.net/mailman/listinfo/py-dev
> 

-- 



More information about the Pytest-dev mailing list