On Jan 30, 2013, at 5:43 AM, George Sakkis wrote: > Hello, > > I am in the process of migrating to PyPy and have a handful of unit test > failing due to the different garbage collector and SQLAlchemy's usage of weak > references in the Session identity map. Most failures are probably safe to > ignore and all of them are fixed after manually calling gc.collect() > somewhere in the test.
this is true but FTR we do have a pypy suite up on jenkins.sqlalchemy.org, we don't run it often because it takes hours, but we did go through lots of effort to ensure that all the tests pass, and those that just really need cPython's GC are skipped. Unless you're referring to your own tests..... > > One specific failure though looks more worrying: a Session.rollback() call in > the test's tearDown() method raises "InvalidRequestError: Can't attach > instance `X`; another instance with key (<class `X`>, (8L, 1L)) is already > present in this session." Before digging deeper, any idea on why it is > triggered here and not in any other test? it would be impossible to say without specific details and examples. Generally there is probably some logic that relies upon an X(8, 1) being garbage collected from the Session (note the identity map is weak referencing) so that an add() later on can succeed. An add() inside of a tearDown() is kind of strange, though, the stack trace would tell you how it's getting there. > Is there another/better way to prevent it other than calling gc.collect() > before Session.rollback() (and perhaps other Session operations)? I'd make sure the tests use a brand new Session for every test that's clean. > > More generally, are there any other known issues and caveats of running > SQLAlchemy on PyPY? Our own test suite has a lot of performance issues with Pypy, not sure if due to memory or JIT crunching or what, I reported it to their bug tracker at the request of their developers. -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy?hl=en. For more options, visit https://groups.google.com/groups/opt_out.