<?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>Tue, 06 Jan 2009 10:43:58 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<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>
	<item>
		<title>By: Paddy3118</title>
		<link>http://blog.ianbicking.org/2008/07/31/a-doctest-wishlist/comment-page-1/#comment-24288</link>
		<dc:creator>Paddy3118</dc:creator>
		<pubDate>Fri, 01 Aug 2008 08:53:57 +0000</pubDate>
		<guid isPermaLink="false">http://blog.ianbicking.org/2008/07/31/a-doctest-wishlist/#comment-24288</guid>
		<description>On dropping into the interpreter, Duncan Booth set me strait [here](http://groups.google.com/group/comp.lang.python/browse_frm/thread/9c9274bdc43a17d2/0d941af24f2057a2?lnk=gst&#38;q=doctest+pdb#0d941af24f2057a2 "(In answer to) Ruby doctest").</description>
		<content:encoded><![CDATA[<p>On dropping into the interpreter, Duncan Booth set me strait <a href="http://groups.google.com/group/comp.lang.python/browse_frm/thread/9c9274bdc43a17d2/0d941af24f2057a2?lnk=gst&amp;q=doctest+pdb#0d941af24f2057a2" title="(In answer to) Ruby doctest">here</a>.</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-24281</link>
		<dc:creator>Tarek Ziadé</dc:creator>
		<pubDate>Fri, 01 Aug 2008 05:42:56 +0000</pubDate>
		<guid isPermaLink="false">http://blog.ianbicking.org/2008/07/31/a-doctest-wishlist/#comment-24281</guid>
		<description>"Getting nose to run .txt files as doctests is really hard, involving a combination of options I always forget."

Yes that is a problem, the nose plugin is not really handy. We ended up faking regular test cases
to be able to run our .txt doctests easily with Nose. 

see http://www.gawel.org/weblog/2008/07/nose-doctest-plugin-sucks for an example
of such a script.

I think Nose could be enhanced there.


"There’s no way to abort the doctest. Sometimes I’d like to run some environment checks early on, and be able to stop the test if they fail."

You could do a simple assert on your test, with the `REPORT_ONLY_FIRST_FAILURE` flag on. 
The assert can be wrapped in a global function you provide in the test environment.</description>
		<content:encoded><![CDATA[<p>&#8220;Getting nose to run .txt files as doctests is really hard, involving a combination of options I always forget.&#8221;</p>

<p>Yes that is a problem, the nose plugin is not really handy. We ended up faking regular test cases
to be able to run our .txt doctests easily with Nose. </p>

<p>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> for an example
of such a script.</p>

<p>I think Nose could be enhanced there.</p>

<p>&#8220;There’s no way to abort the doctest. Sometimes I’d like to run some environment checks early on, and be able to stop the test if they fail.&#8221;</p>

<p>You could do a simple assert on your test, with the <code>REPORT_ONLY_FIRST_FAILURE</code> flag on. 
The assert can be wrapped in a global function you provide in the test environment.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
