[Zope3-checkins] SVN: zope.testing/branches/3.5/ Ported revision 90401 from the trunk.
Stephan Richter
srichter at cosmos.phy.tufts.edu
Wed Aug 27 03:50:48 EDT 2008
Log message for revision 90403:
Ported revision 90401 from the trunk.
Changed:
U zope.testing/branches/3.5/README.txt
U zope.testing/branches/3.5/src/zope/testing/doctest.py
A zope.testing/branches/3.5/src/zope/testing/doctest.txt
U zope.testing/branches/3.5/src/zope/testing/tests.py
-=-
Modified: zope.testing/branches/3.5/README.txt
===================================================================
--- zope.testing/branches/3.5/README.txt 2008-08-27 07:48:40 UTC (rev 90402)
+++ zope.testing/branches/3.5/README.txt 2008-08-27 07:50:47 UTC (rev 90403)
@@ -58,12 +58,16 @@
Releases
********
-3.5.6 (unreleased)
+3.5.6 (2008/08/27)
==================
-...
+Bugs Fixed:
+-----------
+- Open doctest files in universal mode, so that packages released in Windoes
+ can be tested in Linux, for example.
+
3.5.5 (2008/08/27)
==================
Modified: zope.testing/branches/3.5/src/zope/testing/doctest.py
===================================================================
--- zope.testing/branches/3.5/src/zope/testing/doctest.py 2008-08-27 07:48:40 UTC (rev 90402)
+++ zope.testing/branches/3.5/src/zope/testing/doctest.py 2008-08-27 07:50:47 UTC (rev 90403)
@@ -2074,7 +2074,7 @@
runner = DocTestRunner(verbose=verbose, optionflags=optionflags)
# Read the file, convert it to a test, and run it.
- s = open(filename).read()
+ s = open(filename, 'U').read()
if encoding is None:
encoding = pep263_encoding(s)
if encoding is not None:
@@ -2517,7 +2517,7 @@
# Find the file and read it.
name = os.path.basename(path)
- doc = open(path).read()
+ doc = open(path, 'U').read()
# If an encoding is specified, use it to convert the file to unicode
if encoding is None:
Copied: zope.testing/branches/3.5/src/zope/testing/doctest.txt (from rev 90401, zope.testing/trunk/src/zope/testing/doctest.txt)
===================================================================
--- zope.testing/branches/3.5/src/zope/testing/doctest.txt (rev 0)
+++ zope.testing/branches/3.5/src/zope/testing/doctest.txt 2008-08-27 07:50:47 UTC (rev 90403)
@@ -0,0 +1,32 @@
+========================
+Additional doctest Tests
+========================
+
+Most `doctest` module tests are located within the module. This file only
+tests a few additional features not covered by the module tests, so that the
+changes to the `doctest` module -- which is forked from the Python stanadrd
+library -- are minimized.
+
+Working with Carriage Returns
+-----------------------------
+
+Due to the way releases are made on different platforms, we sometimes test
+files on a *nix system with Windows file endings. Unfortunately, that leaves
+some the tests broken:
+
+ >>> import tempfile
+ >>> fn = tempfile.mktemp()
+ >>> open(fn, 'w').write('Test:\r\n\r\n >>> x = 1 + 1\r\n\r\nDone.\r\n')
+
+Let's now run it as a doctest:
+
+ >>> from zope.testing import doctest
+ >>> doctest.testfile(fn, False)
+ (0, 1)
+
+It worked. Let's also try the test file suite:
+
+ >>> import unittest
+ >>> result = unittest.TestResult()
+ >>> doctest.DocFileSuite(fn, module_relative=False).run(result)
+ <unittest.TestResult run=1 errors=0 failures=0>
Modified: zope.testing/branches/3.5/src/zope/testing/tests.py
===================================================================
--- zope.testing/branches/3.5/src/zope/testing/tests.py 2008-08-27 07:48:40 UTC (rev 90402)
+++ zope.testing/branches/3.5/src/zope/testing/tests.py 2008-08-27 07:50:47 UTC (rev 90403)
@@ -28,6 +28,7 @@
doctest.DocTestSuite('zope.testing.server'),
testrunner.test_suite(),
doctest.DocFileSuite('setupstack.txt'),
+ doctest.DocFileSuite('doctest.txt'),
))
if __name__ == '__main__':
More information about the Zope3-Checkins
mailing list