[Zope-Checkins] SVN: Zope/trunk/lib/python/Testing/ZopeTestCase/ Merged r69818:70069 from 2.10 branch.

Stefan H. Holek stefan at epy.co.at
Fri Sep 8 11:05:47 EDT 2006


Log message for revision 70070:
  Merged r69818:70069 from 2.10 branch.
  
  Layer fix and version bump.
  

Changed:
  U   Zope/trunk/lib/python/Testing/ZopeTestCase/doc/CHANGES.txt
  U   Zope/trunk/lib/python/Testing/ZopeTestCase/doc/VERSION.txt
  U   Zope/trunk/lib/python/Testing/ZopeTestCase/runalltests.py
  A   Zope/trunk/lib/python/Testing/ZopeTestCase/tests.py
  U   Zope/trunk/lib/python/Testing/ZopeTestCase/zopedoctest/functional.py
  A   Zope/trunk/lib/python/Testing/ZopeTestCase/zopedoctest/layerextraction.txt
  U   Zope/trunk/lib/python/Testing/ZopeTestCase/zopedoctest/runalltests.py
  A   Zope/trunk/lib/python/Testing/ZopeTestCase/zopedoctest/testLayerExtraction.py
  A   Zope/trunk/lib/python/Testing/ZopeTestCase/zopedoctest/tests.py

-=-
Modified: Zope/trunk/lib/python/Testing/ZopeTestCase/doc/CHANGES.txt
===================================================================
--- Zope/trunk/lib/python/Testing/ZopeTestCase/doc/CHANGES.txt	2006-09-08 14:59:18 UTC (rev 70069)
+++ Zope/trunk/lib/python/Testing/ZopeTestCase/doc/CHANGES.txt	2006-09-08 15:05:47 UTC (rev 70070)
@@ -12,6 +12,8 @@
 - Added placeless.py for Z3-style setup. Thanks to Whit Morriss.
 - Fixed functional.http() to only pass the request body (no headers) to
   publish_module(). Thanks to Andreas Zeidler.
+- Fixed doctestsuite factory to copy layers from test_class to the suite.
+  Thanks to Whit Morris.
 
 0.9.8 (Zope 2.8 edition)
 - Renamed 'doctest' package to 'zopedoctest' because of name-shadowing

Modified: Zope/trunk/lib/python/Testing/ZopeTestCase/doc/VERSION.txt
===================================================================
--- Zope/trunk/lib/python/Testing/ZopeTestCase/doc/VERSION.txt	2006-09-08 14:59:18 UTC (rev 70069)
+++ Zope/trunk/lib/python/Testing/ZopeTestCase/doc/VERSION.txt	2006-09-08 15:05:47 UTC (rev 70070)
@@ -1 +1 @@
-ZopeTestCase 0.9.8
+ZopeTestCase 0.9.9

Modified: Zope/trunk/lib/python/Testing/ZopeTestCase/runalltests.py
===================================================================
--- Zope/trunk/lib/python/Testing/ZopeTestCase/runalltests.py	2006-09-08 14:59:18 UTC (rev 70069)
+++ Zope/trunk/lib/python/Testing/ZopeTestCase/runalltests.py	2006-09-08 15:05:47 UTC (rev 70070)
@@ -27,12 +27,16 @@
 import unittest
 TestRunner = unittest.TextTestRunner
 suite = unittest.TestSuite()
+cwd = os.getcwd()
 
 def test_finder(recurse, dir, names):
     if dir == os.curdir or '__init__.py' in names:
         parts = [x for x in dir[len(os.curdir):].split(os.sep) if x]
         tests = [x for x in names if x.startswith('test') and x.endswith('.py')]
         for test in tests:
+            if test == 'tests.py' and 'ZopeTestCase' in cwd:
+                # Skip tests.py when running ZTC tests
+                continue
             modpath = parts + [test[:-3]]
             m = __import__('.'.join(modpath))
             for part in modpath[1:]:

Copied: Zope/trunk/lib/python/Testing/ZopeTestCase/tests.py (from rev 70065, Zope/branches/2.10/lib/python/Testing/ZopeTestCase/tests.py)

Modified: Zope/trunk/lib/python/Testing/ZopeTestCase/zopedoctest/functional.py
===================================================================
--- Zope/trunk/lib/python/Testing/ZopeTestCase/zopedoctest/functional.py	2006-09-08 14:59:18 UTC (rev 70069)
+++ Zope/trunk/lib/python/Testing/ZopeTestCase/zopedoctest/functional.py	2006-09-08 15:05:47 UTC (rev 70070)
@@ -204,15 +204,22 @@
     def __init__(self, *args, **kw):
         self._args = args
         self._kw = kw
+        self._layer = None
         self.setup_globs()
         self.setup_test_class()
         self.setup_optionflags()
 
     def doctestsuite(self):
-        return doctest.DocTestSuite(*self._args, **self._kw)
+        suite = doctest.DocTestSuite(*self._args, **self._kw)
+        if self._layer is not None:
+            suite.layer = self._layer
+        return suite
 
     def docfilesuite(self):
-        return doctest.DocFileSuite(*self._args, **self._kw)
+        suite = doctest.DocFileSuite(*self._args, **self._kw)
+        if self._layer is not None:
+            suite.layer = self._layer
+        return suite
 
     def setup_globs(self):
         globs = self._kw.setdefault('globs', {})
@@ -228,6 +235,10 @@
         if 'test_class' in self._kw:
             del self._kw['test_class']
 
+        # Fix for http://zope.org/Collectors/Zope/2178
+        if hasattr(test_class, 'layer'):
+            self._layer = test_class.layer
+
         # If the test_class does not have a runTest method, we add
         # a dummy attribute so that TestCase construction works.
         if not hasattr(test_class, 'runTest'):
@@ -307,18 +318,15 @@
     module = doctest._normalize_module(module)
     return ZopeSuiteFactory(module, **kw).doctestsuite()
 
-
 def ZopeDocFileSuite(*paths, **kw):
     if kw.get('module_relative', True):
         kw['package'] = doctest._normalize_module(kw.get('package'))
     return ZopeSuiteFactory(*paths, **kw).docfilesuite()
 
-
 def FunctionalDocTestSuite(module=None, **kw):
     module = doctest._normalize_module(module)
     return FunctionalSuiteFactory(module, **kw).doctestsuite()
 
-
 def FunctionalDocFileSuite(*paths, **kw):
     if kw.get('module_relative', True):
         kw['package'] = doctest._normalize_module(kw.get('package'))

Copied: Zope/trunk/lib/python/Testing/ZopeTestCase/zopedoctest/layerextraction.txt (from rev 70065, Zope/branches/2.10/lib/python/Testing/ZopeTestCase/zopedoctest/layerextraction.txt)

Modified: Zope/trunk/lib/python/Testing/ZopeTestCase/zopedoctest/runalltests.py
===================================================================
--- Zope/trunk/lib/python/Testing/ZopeTestCase/zopedoctest/runalltests.py	2006-09-08 14:59:18 UTC (rev 70069)
+++ Zope/trunk/lib/python/Testing/ZopeTestCase/zopedoctest/runalltests.py	2006-09-08 15:05:47 UTC (rev 70070)
@@ -27,12 +27,16 @@
 import unittest
 TestRunner = unittest.TextTestRunner
 suite = unittest.TestSuite()
+cwd = os.getcwd()
 
 def test_finder(recurse, dir, names):
     if dir == os.curdir or '__init__.py' in names:
         parts = [x for x in dir[len(os.curdir):].split(os.sep) if x]
         tests = [x for x in names if x.startswith('test') and x.endswith('.py')]
         for test in tests:
+            if test == 'tests.py' and 'ZopeTestCase' in cwd:
+                # Skip tests.py when running ZTC tests
+                continue
             modpath = parts + [test[:-3]]
             m = __import__('.'.join(modpath))
             for part in modpath[1:]:

Copied: Zope/trunk/lib/python/Testing/ZopeTestCase/zopedoctest/testLayerExtraction.py (from rev 70065, Zope/branches/2.10/lib/python/Testing/ZopeTestCase/zopedoctest/testLayerExtraction.py)

Copied: Zope/trunk/lib/python/Testing/ZopeTestCase/zopedoctest/tests.py (from rev 70065, Zope/branches/2.10/lib/python/Testing/ZopeTestCase/zopedoctest/tests.py)



More information about the Zope-Checkins mailing list