<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	>
<channel>
	<title>Comments on: A Doctest Wishlist</title>
	<atom:link href="http://blog.ianbicking.org/2008/07/31/a-doctest-wishlist/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.ianbicking.org/2008/07/31/a-doctest-wishlist/</link>
	<description></description>
	<pubDate>Wed, 17 Mar 2010 07:37:32 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Jens Klein</title>
		<link>http://blog.ianbicking.org/2008/07/31/a-doctest-wishlist/comment-page-1/#comment-76086</link>
		<dc:creator>Jens Klein</dc:creator>
		<pubDate>Sun, 01 Feb 2009 00:43:25 +0000</pubDate>
		<guid isPermaLink="false">http://blog.ianbicking.org/2008/07/31/a-doctest-wishlist/#comment-76086</guid>
		<description>ad: "I’d like to be able to easily jump into an interactive state from doctest.":

I recently released interlude which is available at [pypi](http://pypi.python.org/pypi/interlude). 
See also my [blog post](http://bluedynamics.com/articles/jens/interlude-write-python-doctests-interactive).

In short: it allows to write...

    &#62;&#62;&#62; interact(locals())

... in your doctest and it jump into interactive mode. It *feels* 
like youre in the doctest and different from pdb. You can just copy paste from interactive 
mode into the test.</description>
		<content:encoded><![CDATA[<p>ad: &#8220;I’d like to be able to easily jump into an interactive state from doctest.&#8221;:</p>

<p>I recently released interlude which is available at <a href="http://pypi.python.org/pypi/interlude">pypi</a>. 
See also my <a href="http://bluedynamics.com/articles/jens/interlude-write-python-doctests-interactive">blog post</a>.</p>

<p>In short: it allows to write&#8230;</p>

<pre><code>&amp;gt;&amp;gt;&amp;gt; interact(locals())
</code></pre>

<p>&#8230; in your doctest and it jump into interactive mode. It <em>feels</em> 
like youre in the doctest and different from pdb. You can just copy paste from interactive 
mode into the test.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: gioby</title>
		<link>http://blog.ianbicking.org/2008/07/31/a-doctest-wishlist/comment-page-1/#comment-70139</link>
		<dc:creator>gioby</dc:creator>
		<pubDate>Fri, 09 Jan 2009 15:46:54 +0000</pubDate>
		<guid isPermaLink="false">http://blog.ianbicking.org/2008/07/31/a-doctest-wishlist/#comment-70139</guid>
		<description>I agree with your points.
It would be good to be able to set global fixtures for doctest (not only with nose, but in doctest in general).
It is very silly when you write functions that open and read files, and you have to repeat a StringIO or TemporaryFile import everytime.
In general, I don't understand why there is no way to declare some setup and teardown methods for doctests, while it would be the most useful.

You can enable ELLIPSIS = True for every test automatically by passing optionflags=doctest.ELLIPSIS to testmod(), but it is ugly.</description>
		<content:encoded><![CDATA[<p>I agree with your points.
It would be good to be able to set global fixtures for doctest (not only with nose, but in doctest in general).
It is very silly when you write functions that open and read files, and you have to repeat a StringIO or TemporaryFile import everytime.
In general, I don&#8217;t understand why there is no way to declare some setup and teardown methods for doctests, while it would be the most useful.</p>

<p>You can enable ELLIPSIS = True for every test automatically by passing optionflags=doctest.ELLIPSIS to testmod(), but it is ugly.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tarek Ziadé</title>
		<link>http://blog.ianbicking.org/2008/07/31/a-doctest-wishlist/comment-page-1/#comment-25978</link>
		<dc:creator>Tarek Ziadé</dc:creator>
		<pubDate>Sat, 09 Aug 2008 06:22:16 +0000</pubDate>
		<guid isPermaLink="false">http://blog.ianbicking.org/2008/07/31/a-doctest-wishlist/#comment-25978</guid>
		<description>@Jason Pellerin

Thanks for the info, I'll give a shot</description>
		<content:encoded><![CDATA[<p>@Jason Pellerin</p>

<p>Thanks for the info, I&#8217;ll give a shot</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Noah Gift</title>
		<link>http://blog.ianbicking.org/2008/07/31/a-doctest-wishlist/comment-page-1/#comment-24531</link>
		<dc:creator>Noah Gift</dc:creator>
		<pubDate>Mon, 04 Aug 2008 12:28:16 +0000</pubDate>
		<guid isPermaLink="false">http://blog.ianbicking.org/2008/07/31/a-doctest-wishlist/#comment-24531</guid>
		<description>I will second Stefan's comments about IPython, it has changed the way I write Python code, and as such doctest is even more important.  Fortunately IPython has a form of support for doctest.  I think there are some improvements that could be made, but I find it very useful to go into doctest mode in IPython to try something out, then when I am done, paste that code into a test.</description>
		<content:encoded><![CDATA[<p>I will second Stefan&#8217;s comments about IPython, it has changed the way I write Python code, and as such doctest is even more important.  Fortunately IPython has a form of support for doctest.  I think there are some improvements that could be made, but I find it very useful to go into doctest mode in IPython to try something out, then when I am done, paste that code into a test.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stefan Eletzhofer</title>
		<link>http://blog.ianbicking.org/2008/07/31/a-doctest-wishlist/comment-page-1/#comment-24331</link>
		<dc:creator>Stefan Eletzhofer</dc:creator>
		<pubDate>Fri, 01 Aug 2008 20:37:07 +0000</pubDate>
		<guid isPermaLink="false">http://blog.ianbicking.org/2008/07/31/a-doctest-wishlist/#comment-24331</guid>
		<description>" ... I wish I could copy and paste from doctests to consoles. But I don’t see any solution to this problem. ... "

I use IPython. It solves quite some problems:

- allows for pasting doctests and evaluating them (IPython.dtutils.idoctest), optionally

- raising a exception on the first failure

- doing a post-mortem pdb automatically

- executing the doctest in a separate namespace

- switching to a "normal" prompt (ipython normally has a fancy, colored, history-enabled prompt),
   so you can paste code from the interpreter to a doctest. One might consider this not a new feature,
   because the standard interpreter has this too :P

Btw, you can invoke a IPython-enabled pdb by using http://pypi.python.org/pypi/ipdb and:

  from ipdb import set_trace; set_trace()

I like IPython :)

Stefan.</description>
		<content:encoded><![CDATA[<p>&#8221; &#8230; I wish I could copy and paste from doctests to consoles. But I don’t see any solution to this problem. &#8230; &#8220;</p>

<p>I use IPython. It solves quite some problems:</p>

<ul>
<li><p>allows for pasting doctests and evaluating them (IPython.dtutils.idoctest), optionally</p></li>
<li><p>raising a exception on the first failure</p></li>
<li><p>doing a post-mortem pdb automatically</p></li>
<li><p>executing the doctest in a separate namespace</p></li>
<li><p>switching to a &#8220;normal&#8221; prompt (ipython normally has a fancy, colored, history-enabled prompt),
so you can paste code from the interpreter to a doctest. One might consider this not a new feature,
because the standard interpreter has this too :P</p></li>
</ul>

<p>Btw, you can invoke a IPython-enabled pdb by using <a href="http://pypi.python.org/pypi/ipdb" rel="nofollow">http://pypi.python.org/pypi/ipdb</a> and:</p>

<p>from ipdb import set<em>trace; set</em>trace()</p>

<p>I like IPython :)</p>

<p>Stefan.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jason Pellerin</title>
		<link>http://blog.ianbicking.org/2008/07/31/a-doctest-wishlist/comment-page-1/#comment-24318</link>
		<dc:creator>Jason Pellerin</dc:creator>
		<pubDate>Fri, 01 Aug 2008 16:59:22 +0000</pubDate>
		<guid isPermaLink="false">http://blog.ianbicking.org/2008/07/31/a-doctest-wishlist/#comment-24318</guid>
		<description>“Getting nose to run .txt files as doctests is really hard, involving a combination of options I always forget.”

Me too, which is why I put them in setup.cfg and/or ~/.noserc:

    [nosetests]
    with-doctest=1
    doctest-extension=.txt

"see http://www.gawel.org/weblog/2008/07/nose-doctest-plugin-sucks ... I think Nose could be enhanced there."

Unfortunately, I don't speak French, so I'm only guessing that the post there is complaining about the lack of support in the doctest plugin for fixtures. If that's the case, some support is scheduled for the next nose release: 

http://code.google.com/p/python-nose/issues/detail?id=60

You can find the current state of fixture support in the ticket-93 branch in nose's svn. If you find it still too sucky, patches are always welcome.</description>
		<content:encoded><![CDATA[<p>“Getting nose to run .txt files as doctests is really hard, involving a combination of options I always forget.”</p>

<p>Me too, which is why I put them in setup.cfg and/or ~/.noserc:</p>

<pre><code>[nosetests]
with-doctest=1
doctest-extension=.txt
</code></pre>

<p>&#8220;see <a href="http://www.gawel.org/weblog/2008/07/nose-doctest-plugin-sucks" rel="nofollow">http://www.gawel.org/weblog/2008/07/nose-doctest-plugin-sucks</a> &#8230; I think Nose could be enhanced there.&#8221;</p>

<p>Unfortunately, I don&#8217;t speak French, so I&#8217;m only guessing that the post there is complaining about the lack of support in the doctest plugin for fixtures. If that&#8217;s the case, some support is scheduled for the next nose release: </p>

<p><a href="http://code.google.com/p/python-nose/issues/detail?id=60" rel="nofollow">http://code.google.com/p/python-nose/issues/detail?id=60</a></p>

<p>You can find the current state of fixture support in the ticket-93 branch in nose&#8217;s svn. If you find it still too sucky, patches are always welcome.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: slinkp</title>
		<link>http://blog.ianbicking.org/2008/07/31/a-doctest-wishlist/comment-page-1/#comment-24315</link>
		<dc:creator>slinkp</dc:creator>
		<pubDate>Fri, 01 Aug 2008 16:06:36 +0000</pubDate>
		<guid isPermaLink="false">http://blog.ianbicking.org/2008/07/31/a-doctest-wishlist/#comment-24315</guid>
		<description>Regarding pdb, a tip I learned from Rob Miller is that you want to put your set_trace() on the same line as the code you want to step into:

&#62;&#62;&#62; import pdb; pdb.set_trace(); foo() 

And once you step out of foo(), you can still step through the doctest, but stupidly you can't see what line you're on. This sucks.</description>
		<content:encoded><![CDATA[<p>Regarding pdb, a tip I learned from Rob Miller is that you want to put your set_trace() on the same line as the code you want to step into:</p>

<p>&gt;&gt;&gt; import pdb; pdb.set_trace(); foo() </p>

<p>And once you step out of foo(), you can still step through the doctest, but stupidly you can&#8217;t see what line you&#8217;re on. This sucks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ian Bicking</title>
		<link>http://blog.ianbicking.org/2008/07/31/a-doctest-wishlist/comment-page-1/#comment-24310</link>
		<dc:creator>Ian Bicking</dc:creator>
		<pubDate>Fri, 01 Aug 2008 15:02:40 +0000</pubDate>
		<guid isPermaLink="false">http://blog.ianbicking.org/2008/07/31/a-doctest-wishlist/#comment-24310</guid>
		<description>Some notes:

 * Stuff like `pdb.set_trace()` is good, but it's better when you can do it when the test fails (what zope.testing and nose can do with options).  Interaction isn't *part* of the test, it's part of the testing process.

 * Something I forgot to mention: `REPORT_UDIFF` also has this problem.  You have to put the option into the test to see the diff'd output, but it's really part of the testing process, something you apply when you can't quickly see the differences in output.

 * `REPORT_ONLY_FIRST` doesn't work: it still *runs* all the other examples, it just doesn't report them.  This is often fine, but sometimes I really want to abort the test.  A common example would be a database-oriented set of tests, when I can't open the database connection.  Sometimes when testing destructive file operations it's actually dangerous to continue the test if you can't confirm that you are in a safe scratch area.</description>
		<content:encoded><![CDATA[<p>Some notes:</p>

<ul>
<li><p>Stuff like <code>pdb.set_trace()</code> is good, but it&#8217;s better when you can do it when the test fails (what zope.testing and nose can do with options).  Interaction isn&#8217;t <em>part</em> of the test, it&#8217;s part of the testing process.</p></li>
<li><p>Something I forgot to mention: <code>REPORT_UDIFF</code> also has this problem.  You have to put the option into the test to see the diff&#8217;d output, but it&#8217;s really part of the testing process, something you apply when you can&#8217;t quickly see the differences in output.</p></li>
<li><p><code>REPORT_ONLY_FIRST</code> doesn&#8217;t work: it still <em>runs</em> all the other examples, it just doesn&#8217;t report them.  This is often fine, but sometimes I really want to abort the test.  A common example would be a database-oriented set of tests, when I can&#8217;t open the database connection.  Sometimes when testing destructive file operations it&#8217;s actually dangerous to continue the test if you can&#8217;t confirm that you are in a safe scratch area.</p></li>
</ul>
]]></content:encoded>
	</item>
	<item>
		<title>By: ogrisel</title>
		<link>http://blog.ianbicking.org/2008/07/31/a-doctest-wishlist/comment-page-1/#comment-24297</link>
		<dc:creator>ogrisel</dc:creator>
		<pubDate>Fri, 01 Aug 2008 12:09:38 +0000</pubDate>
		<guid isPermaLink="false">http://blog.ianbicking.org/2008/07/31/a-doctest-wishlist/#comment-24297</guid>
		<description>The zope.testing [1] testrunner launched with the -D option drops pdb as postmortem shell when a test fails. This test runner can be used easily for non-zope related project. This is really a huge time saving feature when doing TDD.

[1] https://launchpad.net/zope.testing</description>
		<content:encoded><![CDATA[<p>The zope.testing [1] testrunner launched with the -D option drops pdb as postmortem shell when a test fails. This test runner can be used easily for non-zope related project. This is really a huge time saving feature when doing TDD.</p>

<p>[1] <a href="https://launchpad.net/zope.testing" rel="nofollow">https://launchpad.net/zope.testing</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gavin Panella</title>
		<link>http://blog.ianbicking.org/2008/07/31/a-doctest-wishlist/comment-page-1/#comment-24295</link>
		<dc:creator>Gavin Panella</dc:creator>
		<pubDate>Fri, 01 Aug 2008 12:05:41 +0000</pubDate>
		<guid isPermaLink="false">http://blog.ianbicking.org/2008/07/31/a-doctest-wishlist/#comment-24295</guid>
		<description>You can drop into `pdb` with the usual `import pdb; pdb.set_trace()`, but, in my experience, you land in the middle of `pdb`'s code. Just `next` to get back to the doctest scope.</description>
		<content:encoded><![CDATA[<p>You can drop into <code>pdb</code> with the usual <code>import pdb; pdb.set_trace()</code>, but, in my experience, you land in the middle of <code>pdb</code>&#8217;s code. Just <code>next</code> to get back to the doctest scope.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.489 seconds -->
