Test-first and mock objects with PyOpenGL

Phlip phlip_cpp at yahoo.com
Fri Apr 19 11:56:47 EDT 2002


Alpha OpenGL Engineers:

I have a large spike-solution ("quicky non-production quality code
base") of PyOpenGL, and I want to refactor it into something healthy.

I don't want to use GuruChecksOutput. This means I want tests that
reveal changes did not affect how the code call the GL libraries.

The standard way to do this is to provide a MockObject in place of
something, call the tested functions, let them call into the
MockObject, and test what they told it. If these values did not change
then the refactor did not break anything important.

However, I don't know if I have to Mock GL itself. Maybe I can replace
OpenGL's back-end with a Mock that renders not to the screen but into
my test code.

Who has done this and knows the pattern for it?

-- 
  Phlip



More information about the Python-list mailing list