[Zope3-Users] Re: zalchemy - default engine?

Brandon Craig Rhodes brandon at rhodesmill.org
Tue Apr 8 17:43:36 EDT 2008

I want to claim that "zc.recipe.testrunner" should throw up a
traceback when a test hits an "import error", since otherwise it's
pretty dratted impossible to tell where the bad import was.  When
trying to figure out why my application was broken this afternoon (it
was because: z3c.zalchemy had been updated to no longer work against
any copy of SQLAlchemy I could find), it didn't help that the errors
from my test suites were as follows.

Trying to run the test suite of my "bottom-level" module, that imports
my database tables, gave the result:

        Running tests at level 1
        Test-module import failures:

        Module: gatech.mage_database.tests.test_docstrings

        AttributeError: 'module' object has no attribute 'class_state_getter'

My next package's test suite, that uses the database tables defined in
the first package to create and destroy combinations of objects and
model their behavior, gave a quite different error message:

        Running tests at level 1
        Test-module import failures:

        Module: gatech.iam.tests.test_docstrings

        Traceback (most recent call last):
          File "/home/brandon/IamAPI/dev/gatech.iam/src/gatech/iam/__init__.py", line 5, in <module>
            from .model import (
          File "/home/brandon/IamAPI/dev/gatech.iam/src/gatech/iam/model.py", line 15, in <module>
            from z3c.zalchemy import getSession
        ImportError: cannot import name getSession

Finally, my Grok web application, which presents an XML-RPC interface
through which users can manipulate the objects defined in the second
package described above, gave this error when I tried to run its test

        Running tests at level 1
        Test-module import failures:

        Module: iamapi.tests.test_docstrings

        ImportError: No module named buckets

Thank goodness I saw Christian's quick and helpful response to someone
here on the mailing list!  I would not even have guessed from the
above message that z3c.zalchemy was behind every one of those errors.
When I downgraded z3c.zalchemy to the previous version, *all three* of
the test suites started running again, and succeeded!

All three of the above messages, therefore, were each, in some way,
trying to complain about the same problem.  And yet they look like
completely different errors, and only one of them even mentions
z3c.zalchemy.  I find this somehow depressing, but I'll go eat some
dinner and see if that perks me up.  (Don't tell ANYONE I said this,
but the magic that seems to be involved in the above error messages -
the sheer ability of this problem to masquerade as three different
problems - reminds me of what I've heard people say about Rails!)

Brandon Craig Rhodes   brandon at rhodesmill.org   http://rhodesmill.org/brandon

More information about the Zope3-users mailing list