You are not logged in Log in Join
You are here: Home » Members » Stefan's Home » ZopeTestCaseWiki » ZopeLiteLayer » wikipage_view

Log in
Name

Password

 
 
FrontPage »

ZopeLiteLayer

Because our testing landscape has changed quite a bit over the years, it became apparent that having ZTC take control of the startup process is no longer viable. The solution is to move all of ZopeTestCase to a test layer.

How does this affect you?

  • If you aren't using ZopeTestCase you are safe (in fact, safer than you have been before).
  • If you are using ZTC but have not created your own layers, you are also safe.
  • If you are using ZTC with your own layers, you have to check whether these layers need to derive from Testing.ZopeTestCase.layer.ZopeLite.

At the moment, the ZopeLite layer is only available on Zope trunk (2.11). This means that ZTC tests that are supposed to run with, say, Zope 2.10 and Zope 2.11, will need to import and use the layer conditionally. For the general case, this looks something like this:

  class MyLayer:

      @classmethod
      def setUp(cls):
          ...

      @classmethod
      def tearDown(cls):
          ...

  try:
      from Testing.ZopeTestCase.layer import ZopeLite
  except ImportError:
      pass # Zope < 2.11
  else:
      MyLayer.__bases__ = (ZopeLite,)

Note: It is possible to use trunk's ZopeTestCase with Zope 2.10 (just copy it over). It is however unlikely that the layer will ever be backported to the 2.10 line because of BBB concerns.