Closed mcepl closed 3 years ago
FWIW, I've seen similar issues and tracked it down to the version of SQLAlchemy -- I can get passing tests as late as SQLAlchemy==1.3.24
, but with SQLAlchemy==1.4.0
and later I too get 46 failures.
It seems to be related to some tests re-initializing a Session
post-commit()
; at any rate, adding an expire_on_commit=False
when calling sessionmaker()
seems to solve it in most cases.
@mcepl @tipabu Thanks for filing this issue, and the associated pull request, and my apologies for being so tardy on taking a look at this. I don't spend as much time on PyKMIP nowadays as I would like.
I'll give the pull request a review within the next day or so.
When running the test suite for PyKMIP (using platform linux -- Python 3.6.13, pytest-6.2.4, py-1.10.0, pluggy-0.13.1, SQLAlchemy-1.4.15-207.2, full log with all details) 46 tests fail on this construct:
with the error:
sqlalchemy.orm.exc.DetachedInstanceError: Instance <OpaqueObject at 0x7f3da8148048> is not bound to a Session; attribute refresh operation cannot proceed (Background on this error at: http://sqlalche.me/e/14/bhk3)
. I was looking at the suggested web page, I dimly understand the issue, but I cannot understand how it applies here. Is itManagedObject
which is the unadjusted one, orobj
?