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

M.-A. Lemburg mal at egenix.com
Fri Oct 13 13:22:46 EDT 2006

M.-A. Lemburg wrote:
> Chris Withers wrote:
>> M.-A. Lemburg wrote:
>>>> If you fail to use -k, the zope test runner will delete bytecode for all
>>>> your products - including mxODBCZopeDA, which has no .py files to fall
>>>> back on.  Ouch. I'll investigate further - there might be a bug to file
>>>> against zope.testing.
>>> Why does the test runner delete .pyc files in directories it
>>> doesn't own ?
>> The common case used to be:
>> 1. run tests in a checkout (generates .pyc's for each .py file imported)
>> 2. svn up, which deletes a load of .py files
>> 3. re-run tests, curse and swear that there are still .pyc files lying
>>    around that got imported, and you only noticed when your production
>>    environment broke, because you rebuild that out from scratch on
>>    upgrade
>> ...so the "autho-pyc-destructor" was built ;-)
> 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.

Here's another way:



you can convert any .pyc file into a .py file which
will import just like the .pyc file. The script also
supports glob patterns, so you can do:

    pyc2py.py *.pyc

Imports will run a tad slower, but that shouldn't matter
for an application server like Zope.

Marc-Andre Lemburg

Professional Python Services directly from the Source  (#1, Oct 13 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