[Zope3-checkins] SVN: zope.testing/trunk/src/zope/testing/testrunner Removed sample2/sampletests_i.py from the project.

Tim Peters tim.one at comcast.net
Thu Sep 29 14:06:17 EDT 2005


Log message for revision 38691:
  Removed sample2/sampletests_i.py from the project.
  
  Changed the testrunner.txt doctest that uses it to 
  create it dynamically instead.
  
  The file contained a (deliberate) syntax error.  As a result,
  every project (like ZODB) that _includes_ zope.testing shipped
  with an uncompilable .py file.  Users installing such projects
  then got nagged by complaints from distutils, when distutils
  tried to compile all the .py files (it couldn't compile
  sampletests_i.py because of its syntax error, and so reasonably
  complained about that).
  

Changed:
  D   zope.testing/trunk/src/zope/testing/testrunner-ex/sample2/sampletests_i.py
  U   zope.testing/trunk/src/zope/testing/testrunner.txt

-=-
Deleted: zope.testing/trunk/src/zope/testing/testrunner-ex/sample2/sampletests_i.py
===================================================================
--- zope.testing/trunk/src/zope/testing/testrunner-ex/sample2/sampletests_i.py	2005-09-29 17:56:14 UTC (rev 38690)
+++ zope.testing/trunk/src/zope/testing/testrunner-ex/sample2/sampletests_i.py	2005-09-29 18:06:16 UTC (rev 38691)
@@ -1,24 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2003 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-
-importx unittest
-from zope.testing import doctest
-
-class Test(unittest.TestCase):
-
-    def test(self):
-        self.assertEqual(1,0)
-        
-def test_suite():
-    return unittest.makeSuite(Test)

Modified: zope.testing/trunk/src/zope/testing/testrunner.txt
===================================================================
--- zope.testing/trunk/src/zope/testing/testrunner.txt	2005-09-29 17:56:14 UTC (rev 38690)
+++ zope.testing/trunk/src/zope/testing/testrunner.txt	2005-09-29 18:06:16 UTC (rev 38691)
@@ -1469,8 +1469,20 @@
 ----------------------------
 
 If there are errors when importing a test module, these errors are
-reported:
+reported.  In order to illustrate a module with a syntax error, we create
+one now:  this module used to be checked in to the project, but then it was
+included in distributions of projects using zope.testing too, and distutils
+complained about the syntax error when it compiled Python files during
+installation of such projects.  So first we create a module with bad syntax:
 
+    >>> badsyntax_path = os.path.join(directory_with_tests,
+    ...                               "sample2", "sampletests_i.py")
+    >>> f = open(badsyntax_path, "w")
+    >>> print >> f, "importx unittest"  # syntax error
+    >>> f.close()
+
+Then run the tests:
+
     >>> sys.argv = ('test --tests-pattern ^sampletests(f|_i)?$ --layer 1 '
     ...            ).split()
     >>> testrunner.run(defaults)
@@ -1479,7 +1491,7 @@
     <BLANKLINE>
     Module: sample2.sampletests_i
     <BLANKLINE>
-      File "testrunner-ex/sample2/sampletests_i.py", line 15
+      File "testrunner-ex/sample2/sampletests_i.py", line 1
         importx unittest
                        ^
     SyntaxError: invalid syntax
@@ -1548,7 +1560,10 @@
       sample2.sample23.sampletests_i
     True
 
+And remove the file with bad syntax:
 
+    >>> os.remove(badsyntax_path)
+
 Debugging
 ---------
 



More information about the Zope3-Checkins mailing list