Re: [Zope3-Users] Re: [Zope] Debugging doctests

2006-02-24 Thread Lennart Regebro
On 2/24/06, Martijn Pieters [EMAIL PROTECTED] wrote:
 On 2/23/06, Lennart Regebro [EMAIL PROTECTED] wrote:
  Not to mention, doctests are not debuggable from WingIDE. ;-)

 In 2.1 you can; the following is the equivalent of pdb.set_trace():

   wingdbstub.debugger.Break()

 :)

Oh, cool. I need to get 2.1. :)

--
Lennart Regebro, Nuxeo http://www.nuxeo.com/
CPS Content Management http://www.cps-project.org/
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Re: [Zope] Debugging doctests

2006-02-24 Thread Stephan Richter
On Thursday 23 February 2006 17:18, Chris McDonough wrote:
 On Feb 23, 2006, at 4:51 PM, Stephan Richter wrote:
  So, I take it that you are a second voter in favor of not requiring  
  all tests
  to be doctests.

 If the ZSCP thing takes off, I think test/doc req'ts should be  
 somewhat looser than mandating a particular test/doc framework  
 (something along the lines of must have good test coverage and  
 appropriate narrative documentation, maybe with examples of what  
 this means that could be in doctest format by default).  Would that  
 be acceptable?

If there is enough outcry by developers, then yes. ;-)

The problem is that it becomes hard to verify that documentation does not 
deteriorate over time. That means we need certification manager overhead to 
check that; and it would actually be a difficult task. With doctests I can at 
least force the developer to update the documentation examples, and if s/he 
is interested in his package at all, s/he will update the text around it as 
well.

BTW, I have no problem to make the requirements tool independent. I could do 
the following changes:

Doctest-based Testing -- Documentation-based Testing

Actually I just did.

Maybe I should also change::

Minimal Documentation -- Minimal, Testable Documentation
Complete Documentation -- Complete, Testable Documentation

Mmmh, now that I look at the matrix, I really think I should have a small 
explanatory snippet for each metric (below the matrix).

Regards,
Stephan
-- 
Stephan Richter
CBU Physics  Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Re: [Zope] Debugging doctests

2006-02-23 Thread Benji York

Stephan Richter wrote:
 On Thursday 23 February 2006 08:13, Lennart Regebro wrote:

As you see, I can't even step into that next line. And even if I
could, the necessity of having to step through the doctestrunning
would be a major pain in the ass.

 Ok, I have never needed this. And I can see why it does not work.
 Every doctest line is its own expression. I personally can live with
 that limitation. As I said, I have never needed this.

On the rare occasions when I have wanted to do that, I just make
whatever I want to step through into a single doctest line, like so:

 a = 1
 b = 2
 c = a + b

Becomes

 if 1:
... import pdb;pdb.set_trace()
... a = 1
... b = 2
... c = a + b

Ugly, but it works.  I too would like it if a bare set_trace() would
allow you to step through a doctest, but don't know if anyone is
sufficiently motivated to figure out the details (or a suitable
alternative).
--
Benji York
Senior Software Engineer
Zope Corporation
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Re: [Zope] Debugging doctests

2006-02-23 Thread Gary Poster


On Feb 23, 2006, at 10:10 AM, Benji York wrote:
[...]

 if 1:
... import pdb;pdb.set_trace()
... a = 1
... b = 2
... c = a + b


Oh yeah.  I've had to do stuff like that too. :-)
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Re: [Zope] Debugging doctests

2006-02-23 Thread Chris McDonough
I dunno about sucking because they are quite good for documentation,  
but I tend to write plain-old unittests instead of doctests when I'm  
testing without any pretense towards writing documentation.  If you  
test internals of a class in a doctest, the doctest body gets pretty  
cluttered, which tends to defeat the documentation-esque-ness of them.


Being able to set a breakpoint in the test body is important for me  
too.  I probably could be setting breakpoints once I'm in the  
debugger, but it's often easier to just stuff in a pdb.set_trace()  
before the line of code that I want to examine.   And putting a set  
trace in a unittest is a natural thing to do, because you know the  
set trace will only get invoked once during a test run (as opposed to  
putting it right in the app code, where it might get invoked by  
accident through a different test).  Setting breakpoints in unittest- 
tests is typically more fruitful than putting them in doctest-tests  
for the reasons that have been talked about in this thread.


- C

On Feb 23, 2006, at 11:27 AM, Lennart Regebro wrote:


On 2/23/06, Gary Poster [EMAIL PROTECTED] wrote:

You effectively can't step through all the tests (with a single
pdb).  You can step through a single line in the test well.  While it
sounds limiting, that has proved quite sufficient for me in
practice.  YMMV, of course.


Sigh. doctests really do suck.

--
Lennart Regebro, Nuxeo http://www.nuxeo.com/
CPS Content Management http://www.cps-project.org/
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )



___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Re: [Zope] Debugging doctests

2006-02-23 Thread Benji York

Chris McDonough wrote:
I dunno about sucking because they are quite good for documentation,  
but I tend to write plain-old unittests instead of doctests when I'm  
testing without any pretense towards writing documentation.  If you  
test internals of a class in a doctest, the doctest body gets pretty  
cluttered, which tends to defeat the documentation-esque-ness of them.


Are you talking about doctests in docstrings?  If so, I definitely see 
downsides to that use case.  I was talking about doctests in stand-alone 
text files.  That's my (and several others) preferred way of using them.


If you /were/ talking about stand-alone doctests, then I have no idea 
what you're talking about. :)

--
Benji York
Senior Software Engineer
Zope Corporation
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Re: [Zope] Debugging doctests

2006-02-23 Thread Lennart Regebro
On 2/23/06, Chris McDonough [EMAIL PROTECTED] wrote:
 I dunno about sucking because they are quite good for documentation,

Oh, absolutely.

 but I tend to write plain-old unittests instead of doctests when I'm
 testing without any pretense towards writing documentation.

Exactly my sentiments.

 Being able to set a breakpoint in the test body is important for me
 too.  I probably could be setting breakpoints once I'm in the
 debugger

Well, how do you set a breakpoint in something which has no py-file
and line, but is in a text-document or string? :-)

Not to mention, doctests are not debuggable from WingIDE. ;-)

--
Lennart Regebro, Nuxeo http://www.nuxeo.com/
CPS Content Management http://www.cps-project.org/
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Re: [Zope] Debugging doctests

2006-02-23 Thread Chris McDonough

On Feb 23, 2006, at 1:17 PM, Benji York wrote:


Chris McDonough wrote:
I dunno about sucking because they are quite good for  
documentation,  but I tend to write plain-old unittests instead of  
doctests when I'm  testing without any pretense towards writing  
documentation.  If you  test internals of a class in a doctest,  
the doctest body gets pretty  cluttered, which tends to defeat the  
documentation-esque-ness of them.


Are you talking about doctests in docstrings?  If so, I definitely  
see downsides to that use case.  I was talking about doctests in  
stand-alone text files.  That's my (and several others) preferred  
way of using them.


Either.



If you /were/ talking about stand-alone doctests, then I have no  
idea what you're talking about. :)


It's just opinion, but for example, I don't think zope/wfmc/xpdl.txt  
reads much better as a doctest than it would as a plain old  
unittest.  But it's of course a judgment call.


- C

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Re: [Zope] Debugging doctests

2006-02-23 Thread Benji York

Chris McDonough wrote:

On Feb 23, 2006, at 1:17 PM, Benji York wrote:

If you /were/ talking about stand-alone doctests, then I have no  idea 
what you're talking about. :)



It's just opinion, but for example, I don't think zope/wfmc/xpdl.txt  
reads much better as a doctest than it would as a plain old  unittest.  


I agree that xpdl.txt is only marginally better as a doctest in its 
current form.  I'd also claim that it's nearly a degenerate doctest.  It 
really needs more text.


 But it's of course a judgment call.

Perhaps this is just one of those to-each-his-own things. shrug  My 
own are doctests. ;)

--
Benji York
Senior Software Engineer
Zope Corporation
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Re: [Zope] Debugging doctests

2006-02-23 Thread Chris McDonough

On Feb 23, 2006, at 1:57 PM, Benji York wrote:

 But it's of course a judgment call.

Perhaps this is just one of those to-each-his-own things. shrug   
My own are doctests. ;)


Sure.  I actually really appreciate reading good doctests, they help  
a lot, and they beat not having any docs at all any day!


A non-sequitur:  For truly standalone packages, I suspect that people  
expect some form of non-executable narrative documentation to be  
included that ties the continued use of the package together with its  
implementation.  In my experience, it's easy to get lured into  
thinking that you've documented a package properly because it has  
doctests and interface documentation, when in reality it probably  
needs some other form of documentation beyond the doctests (e.g. high- 
level overview of purpose, how to install it, what other packages it  
depends upon, which versions of Python/Zope it works with, who is  
responsible for maintaining the package, where to report bugs, and so  
on).  I suppose this is really a packaging issue, but it would be  
nice if more packages in the  zope namespace package were treated as  
islands like this that could be installed separately from Zope  
proper.  It would also likely help prevent inappropriate dependencies  
from creeping in.  Zope 2 wasn't born a mess of spaghetti  
dependencies, they just sort of grew like weeds over time.


- C

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Re: [Zope] Debugging doctests

2006-02-23 Thread Stephan Richter
On Thursday 23 February 2006 13:37, Lennart Regebro wrote:
 Not to mention, doctests are not debuggable from WingIDE.

Maybe we should have a WingIDE sprint in Boston at some point. This would be a 
good topic.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics  Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Re: [Zope] Debugging doctests

2006-02-23 Thread Stephan Richter
On Thursday 23 February 2006 14:16, Chris McDonough wrote:
  (e.g. high-
 level overview of purpose, how to install it, what other packages it  
 depends upon, which versions of Python/Zope it works with, who is  
 responsible for maintaining the package, where to report bugs, and so  
 on).  I suppose this is really a packaging issue, but it would be  
 nice if more packages in the  zope namespace package were treated as  
 islands like this that could be installed separately from Zope  
 proper.

The ZSCP tries to exactly capture this information and provide it via its 
site.

So, I take it that you are a second voter in favor of not requiring all tests 
to be doctests.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics  Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Re: [Zope] Debugging doctests

2006-02-23 Thread Chris McDonough

On Feb 23, 2006, at 4:51 PM, Stephan Richter wrote:
So, I take it that you are a second voter in favor of not requiring  
all tests

to be doctests.


If the ZSCP thing takes off, I think test/doc req'ts should be  
somewhat looser than mandating a particular test/doc framework  
(something along the lines of must have good test coverage and  
appropriate narrative documentation, maybe with examples of what  
this means that could be in doctest format by default).  Would that  
be acceptable?


- C

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users