[Zope3-dev] FreeBSD Test Results - Zope 3 / Python 2.3 - Too many errors :-(

Steve Alexander steve@cat-box.net
Sun, 20 Jul 2003 12:55:05 +0300


zope-tests@bitdance.com wrote:
> ==============================================================================
> ==============================================================================
> Python Version:2.3b2+ (#12, Jul  1 2003, 10:57:57) 
> [GCC 2.95.4 20020320 [FreeBSD]]
> 
> Modules included:
> Zope3 (HEAD)
> 
> Running unit tests from /var/home/rdmurray/proj/zopeautotest/sandbox/Zope3
> Error in test testAddDeleteDomain (zope.app.browser.services.translation.tests.test_translate.TranslateTest)
> Traceback (most recent call last):
>   File "/var/home/rdmurray/proj/zopeautotest/sandbox/Zope3/src/zope/app/browser/services/translation/tests/test_translate.py", line 61, in setUp
>     self._view = Translate(service, self._getRequest())
> TypeError: default __new__ takes no parameters

I expect that this is due to the difference in the signature of the 
constructor of 'object' in Python 2.2 and Python 2.3.


Python 2.2.3+ (#1, Jul  5 2003, 11:04:18)
[GCC 3.3.1 20030626 (Debian prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
 >>> object(1, 2, 3)
<object object at 0x8168218>


Python 2.3b1 (#1, Jun  4 2003, 16:23:13)
[GCC 2.95.4 20011002 (Debian prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
 >>> object(1, 2, 3)
Traceback (most recent call last):
   File "<stdin>", line 1, in ?
TypeError: default __new__ takes no parameters


The solution is to make sure you write an __init__ method that accepts 
the appropriate arguments.

This is often the case in unit-tests where a dummy class is written 
using the minimum lines of code that will actually work.

Unfortunately, this minimum is slightly greater in Python 2.3.

I think pychecker picks up this problem.

--
Steve Alexander