[issue2604] doctest.DocTestCase fails when run repeatedly

2008-04-19 Thread Piet Delport

Changes by Piet Delport [EMAIL PROTECTED]:


--
keywords: +patch
Added file: http://bugs.python.org/file10060/reset_globs.patch

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2604
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2605] Descriptor instance attributes not interpreted consistently

2008-04-16 Thread Piet Delport

Piet Delport [EMAIL PROTECTED] added the comment:

Related: #643841 (new-style special method lookup)

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2605
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue643841] New class special method lookup change

2008-04-16 Thread Piet Delport

Piet Delport [EMAIL PROTECTED] added the comment:

Somewhat related: #2605 (descriptor __get__/__set__/__delete__)

--
nosy: +pjd


Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue643841

___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2604] doctest.DocTestCase fails when run repeatedly

2008-04-11 Thread Piet Delport

Piet Delport [EMAIL PROTECTED] added the comment:

 If any of the variables in test.globs are changed by the test (e.g. 
appending to a list), then rerunning the test will not necessarily give
the same result.

This is true, but modifying the globals such that subsequent runs of the
same test can break equally affects subsequent runs of any other tests
that use that module:  such a test is already broken (unsafe to run with
other tests) to begin with, independent of the DocTestCase.tearDown issue.

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2604
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2604] doctest.DocTestCase fails when run repeatedly

2008-04-11 Thread Piet Delport

Piet Delport [EMAIL PROTECTED] added the comment:

Well, whether that code is wrong depends on whether your project policy
wants repeatable tests or not.  A repeatable and arguably more idiomatic
way of writing that example is to give DocFileSuite a setUp function
which initializes any special globals required by the test.

In any case, DocTestCase allowing non-repeatable tests (which i don't
think are common) is no reason to disallow repeatable tests, which e.g.
at least Zope considers important enough to motivate fixing this issue.
 (Zope is also the source of the code being fixed, if i'm not mistaken.)

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2604
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2605] Descriptor instance attributes not interpreted consistently

2008-04-10 Thread Piet Delport

New submission from Piet Delport [EMAIL PROTECTED]:

Short version:  __get__/__set__/__delete__ attributes on descriptor objects
(as opposed to their types) are treated inconsistently as part of the
descriptor
protocol:  the documentation and support code includes them;  the core
implementation doesn't.

Example:

class D(object):
__get__ = lambda self, i, o: 'D'

class C(object):
d = D()
d.__get__ = lambda i, o: 'd'
d.__set__ = lambda i, v: 1/0

c = C()

According to pydoc and inspect, and the description in the reference manual
(section 3.4.2.3), d's __get__ and __set__ override D's:

 inspect.isdatadescriptor(C.__dict__['d'])
True
 help(C)
class C(__builtin__.object)
|  Data descriptors defined here:
...
|  d

 type(c).__dict__['d'].__get__(c, type(c))
'd'
 type(c).__dict__['d'].__set__(c, 5)
ZeroDivisionError: integer division or modulo by zero

According to CPython, they have no effect:

 c.d
'D'
 c.d = 5; c.d
5

PEP 252 notes: For speed, the get and set methods are type slots, which
points to the CPython behavior being an intentional concession for
performance.

Should CPython respect descriptor object attributes, if reasonable
performance
can be maintained?  Otherwise, should the documentation and support code be
changed to ignore them?

--
components: Interpreter Core, Library (Lib)
messages: 65289
nosy: pjd
severity: normal
status: open
title: Descriptor instance attributes not interpreted consistently
type: behavior
versions: Python 2.2, Python 2.2.1, Python 2.2.2, Python 2.2.3, Python 2.3, 
Python 2.4, Python 2.5, Python 2.6, Python 3.0

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2605
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2604] doctest.DocTestCase fails when run repeatedly

2008-04-09 Thread Piet Delport

New submission from Piet Delport [EMAIL PROTECTED]:

DocTestCase.tearDown destructively clears its DocTest instance's globs,
preventing the test from being run repeatedly (such as with trial
--until-failure).

There's a fix for this in zope.testing's version of doctest, which
resets the globs instead:

http://svn.zope.org/?view=revrev=39023

--
components: Library (Lib)
messages: 65285
nosy: pjd
severity: normal
status: open
title: doctest.DocTestCase fails when run repeatedly
type: behavior
versions: Python 2.4, Python 2.5, Python 2.6, Python 3.0

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2604
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2604] doctest.DocTestCase fails when run repeatedly

2008-04-09 Thread Piet Delport

Piet Delport [EMAIL PROTECTED] added the comment:

Addendum:  This appears to be a regression in r36809 (Python 2.4+).

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2604
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com