[Checkins] SVN: manuel/trunk/ - fix a bug that caused variables assigned in a doctest not to be reflected in
Benji York
benji at zope.com
Thu May 20 09:58:25 EDT 2010
Log message for revision 112575:
- fix a bug that caused variables assigned in a doctest not to be reflected in
the passed-in globs dictionary; fixes half of launchpad bug 582482
Changed:
U manuel/trunk/CHANGES.txt
U manuel/trunk/src/manuel/__init__.py
U manuel/trunk/src/manuel/bugs.txt
-=-
Modified: manuel/trunk/CHANGES.txt
===================================================================
--- manuel/trunk/CHANGES.txt 2010-05-20 13:50:34 UTC (rev 112574)
+++ manuel/trunk/CHANGES.txt 2010-05-20 13:58:24 UTC (rev 112575)
@@ -1,6 +1,13 @@
CHANGES
=======
+1.1.1 (unreleased)
+------------------
+
+- fix a bug that caused variables assigned in a doctest not to be reflected in
+ the passed-in globs dictionary; fixes half of launchpad bug 582482
+
+
1.1.0 (2010-05-18)
------------------
Modified: manuel/trunk/src/manuel/__init__.py
===================================================================
--- manuel/trunk/src/manuel/__init__.py 2010-05-20 13:50:34 UTC (rev 112574)
+++ manuel/trunk/src/manuel/__init__.py 2010-05-20 13:58:24 UTC (rev 112575)
@@ -158,11 +158,13 @@
parser(self)
def evaluate_with(self, m, globs):
- globs = GlobWrapper(globs)
+ wrapped_globs = GlobWrapper(globs)
for region in list(self):
for evaluater in sort_handlers(m.evaluaters):
- evaluater(region, self, globs)
+ evaluater(region, self, wrapped_globs)
+ globs.update(wrapped_globs)
+
def format_with(self, m):
for formatter in sort_handlers(m.formatters):
formatter(self)
Modified: manuel/trunk/src/manuel/bugs.txt
===================================================================
--- manuel/trunk/src/manuel/bugs.txt 2010-05-20 13:50:34 UTC (rev 112574)
+++ manuel/trunk/src/manuel/bugs.txt 2010-05-20 13:58:24 UTC (rev 112575)
@@ -35,10 +35,10 @@
one below would generate a syntax error during parsing.
.. code-block:: python
- :linenos:
+ :linenos:
- class Foo(object):
- pass
+ class Foo(object):
+ pass
.. -> source
@@ -58,3 +58,34 @@
>>> document = manuel.Document('')
>>> document.source
'\n'
+
+
+Glob lifecycle
+--------------
+
+Anything put into the globs during a doctest run should still be in there
+afterward.
+
+ >>> a
+ 1
+
+ >>> b = 2
+
+.. -> source
+
+.. code-block:: python
+
+ import manuel.doctest
+ m = manuel.doctest.Manuel()
+ globs = {'a': 1}
+ document = manuel.Document(source)
+ document.process_with(m, globs=globs)
+
+The doctest in the `source` variable ran with no errors.
+
+ >>> print document.formatted()
+
+And now the globs dictionary reflects the changes made when the doctest ran.
+
+ >>> globs['b']
+ 2
More information about the checkins
mailing list