Mayavi: testing: good news

Hi,

In the past I was complaining that it was hard to write tests for mayavi 
because it needs the UI.  Well, thats not true anymore.  I've made a 
small change to the pipeline_base.py code that allows us to create/run 
tests without creating any user interface or a UI or even using 
offscreen rendering.  This means we can write non-interactive tests for 
the core mayavi.  As a proof of concept I've checked in 
enthought/mayavi/tests/test_array_source.py which is based on the 
earlier integration test of the same name but now a non-interactive 
test.  Take a look to see how it works.  These tests are not image based 
but data based but IMHO they serve the purpose very well.

We'll add more tests to cover the core code over the next few months.

As a note to any folks making checkins into mayavi, I think I'm going to 
start insisting on tests for most or all checkins in the future, there 
isn't any excuse anymore.  I've been a big culprit on my mlab_source 
changes (but that was necessary given the circumstances).  In any case, 
I've made amends and over the next few months we'll hopefully have more 
non-interactive tests. :)

cheers,
--

-- 
Prabhu Ramachandran                 http://www.aero.iitb.ac.in/~prabhu
Gael Varoquaux | 6 Sep 19:52
Favicon

Re: Mayavi: testing: good news

On Sat, Sep 06, 2008 at 10:31:55PM +0530, Prabhu Ramachandran wrote:
> In the past I was complaining that it was hard to write tests for mayavi 
> because it needs the UI.  Well, thats not true anymore.  I've made a 
> small change to the pipeline_base.py code that allows us to create/run 
> tests without creating any user interface or a UI or even using 
> offscreen rendering.  This means we can write non-interactive tests for 
> the core mayavi.

Very cool. This is indeed a "big deal", as your commit message mentions
it.

I had a quick go at checking out if I could modify mlab to
work in such a "null backend" mode. I think it might be possible. Right
now what seems to be that engine.add_source creates a scene.

Here is what I propose: have an option to turn on this null backend
behavior. In this mode, the code base would follow the pattern that you
have started to create object on the pipeline, but not really turn them
live. This would allow us to test a fair amount of the scripting layer of
mayavi, with or without mlab. A good fraction of our examples could then
run non-interactively, and thus be easier to test. We could also easily
write a fair amount of tests.

Does this sound feasible, or am I missing something?

Gaƫl

Re: Mayavi: testing: good news

Gael Varoquaux wrote:
> Very cool. This is indeed a "big deal", as your commit message mentions
> it.

Thanks.

> I had a quick go at checking out if I could modify mlab to
> work in such a "null backend" mode. I think it might be possible. Right
> now what seems to be that engine.add_source creates a scene.
> 
> Here is what I propose: have an option to turn on this null backend
> behavior. In this mode, the code base would follow the pattern that you
> have started to create object on the pipeline, but not really turn them
> live. This would allow us to test a fair amount of the scripting layer of

Actually what we could do is create a dummy scene that doesn't really do 
anything.  Then you wouldn't have to change much, although I wouldn't 
encourate too much testing with that since these really go in the 
category of integrationtests and not unittests.

> mayavi, with or without mlab. A good fraction of our examples could then
> run non-interactively, and thus be easier to test. We could also easily
> write a fair amount of tests.
> 
> Does this sound feasible, or am I missing something?

This might be possible if you aren't manipulating the camera or maybe 
that would work too but I am not sure.  I did not go along that route 
since my first priority was to get the core objects tested as pure and 
simple unit tests.
(Continue reading)


Gmane