[Zope-Checkins] SVN: Zope/branches/2.10/lib/python/Testing/ZopeTestCase/zopedoctest/ tests for Issue 2178

david whitfield Morriss whit at openplans.org
Mon Aug 28 17:33:23 EDT 2006


Log message for revision 69820:
  tests for Issue 2178

Changed:
  A   Zope/branches/2.10/lib/python/Testing/ZopeTestCase/zopedoctest/layerextraction.txt
  A   Zope/branches/2.10/lib/python/Testing/ZopeTestCase/zopedoctest/test_layerextraction.py

-=-
Added: Zope/branches/2.10/lib/python/Testing/ZopeTestCase/zopedoctest/layerextraction.txt
===================================================================
--- Zope/branches/2.10/lib/python/Testing/ZopeTestCase/zopedoctest/layerextraction.txt	2006-08-28 21:24:14 UTC (rev 69819)
+++ Zope/branches/2.10/lib/python/Testing/ZopeTestCase/zopedoctest/layerextraction.txt	2006-08-28 21:33:23 UTC (rev 69820)
@@ -0,0 +1,5 @@
+If the layer is extracted properly, we should see the following
+variable
+
+ >>> getattr(self.app, 'LAYER_EXTRACTED', False)
+ True

Added: Zope/branches/2.10/lib/python/Testing/ZopeTestCase/zopedoctest/test_layerextraction.py
===================================================================
--- Zope/branches/2.10/lib/python/Testing/ZopeTestCase/zopedoctest/test_layerextraction.py	2006-08-28 21:24:14 UTC (rev 69819)
+++ Zope/branches/2.10/lib/python/Testing/ZopeTestCase/zopedoctest/test_layerextraction.py	2006-08-28 21:33:23 UTC (rev 69820)
@@ -0,0 +1,42 @@
+from Testing.ZopeTestCase import ZopeDocFileSuite as FileSuite
+from Testing.ZopeTestCase import ZopeDocTestSuite as TestSuite
+from Testing.ZopeTestCase.ZopeTestCase import ZopeTestCase
+from Testing import ZopeTestCase
+
+import transaction as txn
+
+class TestLayer:
+    """
+    If the layer is extracted properly, we should see the following
+    variable
+
+    >>> getattr(self.app, 'LAYER_EXTRACTED', False)
+    True
+    """
+    @classmethod
+    def setUp(cls):
+        app = ZopeTestCase.app()
+        app.LAYER_EXTRACTED = True
+        txn.commit()
+        ZopeTestCase.close(app)
+
+    @classmethod
+    def tearDown(cls):
+        app = ZopeTestCase.app()
+        del app.LAYER_EXTRACTED
+        txn.commit()
+        ZopeTestCase.close(app)
+
+class TestCase(ZopeTestCase.ZopeTestCase):
+    layer = TestLayer
+
+def test_suite():
+    import unittest
+    fs = FileSuite('layerextraction.txt',
+                   test_class=TestCase,
+                   package='Testing.ZopeTestCase.zopedoctest'
+                   )
+    ts = TestSuite('Testing.ZopeTestCase.zopedoctest.test_layerextraction',
+                   test_class=TestCase,
+                   )
+    return unittest.TestSuite((fs, ts))



More information about the Zope-Checkins mailing list