[ZPatterns] Unit tests for ZPatterns Applications

Roché Compaan sparroy@adept.co.za
Wed, 9 Jan 2002 09:49:03 +0200


> Has anybody been successful in writing unit tests for ZPatterns-based
> applications?

We'll I finally managed to get some unit tests up and running using ZUnit v
0.1.

The caveat I ran into was that __dict__['_v_parent'] was not set for a
DataSkin
in it's __of__ method because the parent Specialist did not have "REQUEST"
as an attribute.
So all I had to do in my unit test was:

 	zc = self.ZopeContext
	app = Zope.app()
	MySpecialist = app.MySpecialist

	MySpecialist.REQUEST = zc.REQUEST

and voila, unit tests are working.

If anybody is interested in more details feel free to mail me.

Roch'e