[TIP] mock-ing java classes in Jython?
fredrik at haard.se
Sun Jul 31 03:23:31 PDT 2011
Hi all (and thanks for the pizza! =),
I'd like to set up a test suite for an embedded J2ME application. Most of
the code is cleanly separated from the platform since it runs on multiple
platforms, and I wanted to use Jython to replace the platform-specific parts
and run both unit and scenario testing on the common parts.
However, naive replacement of the class definitions does not seem to work,
and trying to use mock to patch a java class like this:
with mock.patch('my.device.DeviceHandler') as devicehandler:
AttributeError: 'javapackage' object has no attribute 'DeviceHandler'
Is it possible to get the behavior I want?
I reject your reality and substitute my own.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the testing-in-python