[Zope-DB] Pitfall: mxODBCZopeDA and test runner in 2.9+

M.-A. Lemburg mal at egenix.com
Wed Oct 18 03:34:26 EDT 2006

Paul Winkler wrote:
> On Fri, Oct 13, 2006 at 12:46:27PM +0200, M.-A. Lemburg wrote:
>> Sounds like a developer setup :-)
>> For those I do have a solution:
>> chown root.zope .../Products/mxODBCZopeDA
>> chmod 750 .../Products/mxODBCZopeDA
>> (provided zope is the group of the Zope daemon)
>> That way you prevent deletions in the product directory
>> by any user other than root.
> Yes, Tres suggested that on another list. But doing this also
> prevents the test runner from running any tests :-)
> It bails out with errors like:
> Traceback (most recent call last):
> (snip)
>   File "/home/pw/rhg/code/contentservices_dev/opt/Zope-2.9.1/lib/python/zope/testing/testrunner.py", line 1116, in remove_stale_bytecode
>     os.unlink(fullname)
> OSError: [Errno 13] Permission denied: 
> '/home/pw/dev/instances/zope/lib/python/mx/ODBC/__init__.pyc'

Looks like the testrunner implementation doing the PYC "cleanup"
is seriously broken.

At the very least it should:

 * check for the existence of a corresponding PY file before
   simply going about removing the byte code file

 * ignore any permission errors it finds

BTW, it is not uncommon to put PYC files under version control
as well, namely in the case where you don't regularly switch
Python versions and for files which you normally don't touch,
so as the Python std lib modules.

In such a case the "byte-code-remover" will
cause you serious problems the other way around: because the
byte code contains a timestamp, the PYC files will change with
every recreation and thus Subversion or CVS will want to
check in these changes every time you try to fix a bug...

IMHO, it should be an option to remove the PYC files and not
the default.

Marc-Andre Lemburg

Professional Python Services directly from the Source  (#1, Oct 18 2006)
>>> Python/Zope Consulting and Support ...        http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/

::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::

More information about the Zope-DB mailing list