-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pytest fails with sqlalchemy.exc.UnboundExecutionError: This session is not bound to a single Engine or Connection, and no context was provided to locate a binding.
#348
Comments
sqlalchemy.exc.UnboundExecutionError: This session is not bound to a single Engine or Connection
sqlalchemy.exc.UnboundExecutionError: This session is not bound to a single Engine or Connection, and no context was provided to locate a binding.
I admittedly don't use multiple binds myself, but we create the version session with the same bind, so it should just work. I'm confused by these line numbers:
Have you made local changes? |
Oh you know what, I had the file open in Pycharm while I was debugging and it must have run the Black trigger on the code. Here's the stack trace with a fresh copy of sqlalchemy_continuum:
|
I have found a workaround for now, although it's not ideal. In my top level conftest.py file where I initialize the test databases, I added a call to
This isn't great because I won't be able to test any of the functionality of sqlalchemy-continuum. If anyone knows of a better workaround that doesn't require removing all the sqlalchemy-continuum event listeners, I'd really appreciate the input. |
I just installed sqlalchemy-continuum to track changes to a few tables in a flask app. I was able to get the package up and running, but now my tests are failing when pytest fixtures are invoked. For what it's worth, the
db.session
binds to several databases, which is well supported by flask-sqlalchemy. I'm using Python 3.11.1.Here are the subset of package versions which could be relevant:
This is the abridged stack trace:
I definitely need to support multiple database binds, so if anyone has any idea how to get around this issue it would be much appreciated! Thanks in advance.
The text was updated successfully, but these errors were encountered: