If you'd like to avoid boilerplate testing code, you might also look at using decorators and py.test there was a class at PyCon, and it's up and running again.
http://pycon.blip.tv/file/1956938/ Here are all the talks at Pycon http://pycon.blip.tv/posts?view=archive&nsfw=dc I'm interested in finding out more about how people are testing their pipelines. JohnCreson On Wed, Mar 17, 2010 at 11:14 AM, Chad Dombrova <[email protected]> wrote: >> the problem is, most of my code is "create or modify something in the scene" >> rigging utilities, e.g., create ik/fk/elbowik setup, calculate corrective >> shape, calculate blendshape inbetweens for smooth interpolation. the only >> way i see to test them is to actually load sample scene, execute the code, >> then SOMEHOW test validity of the created data > > yeah, testing is tedious, but you pretty much hit the nail on the head as far > as workflow. with a unittest class, each class has a setUp and tearDown > method, which you can use to ensure that you have the proper testing > environment setup for each test. > >> Anyway, the short version the question: what kind of automated testing you >> guys have used, how that works, and what are cons and pros? > > we use 'nose', which makes running the tests a lot easier. nose will search > a python package for anything that looks like a test -- unittest classes, > doctest strings, and functions named 'test*' -- and run them. this is much > more convenient than explicitly tying together all of your unittest classes > into a test suite. nose also supports generators as tests, so if the problem > you are trying to test for can be tested in a semi-automatic way, this makes > life a lot easier. for example, pymel uses generators to create loop through > its database of nodes and methods and create a test for every get/set method > pair ( ex. getFocalLength, setFocalLength ). > > there's also pythoscope http://pythoscope.org/ which i've never used but > which, if you're testing classes, can help to write a lot of your boilerplate > testing code. > > good luck! > > -chad > > -- > http://groups.google.com/group/python_inside_maya -- http://groups.google.com/group/python_inside_maya
