jeancochrane / jeancochrane/pytest-flask-sqlalchemy
Incompatible with flask-sqlalchemy-3.0
- Dominant language
- Python
- Stars
- 253
- Forks
- 45
- PR merge metrics
- No merged PRs in 30d
Description
Looks like there has been a new major release for flask-sqlalchemy https://flask-sqlalchemy.palletsprojects.com/en/3.0.x/changes/#version-3-0-0 and they have broken backwards compatibility in a few places.
For example :
```
@pytest.fixture(scope='function')
def _transaction(request, _db, mocker):
'''
Create a transactional context for tests to run in.
'''
# Start a transaction
> connection = _db.engine.connect()
../../../.cache/pypoetry/virtualenvs/api-S2mtXI53-py3.8/lib/python3.8/site-packages/pytest_flask_sqlalchemy/fixtures.py:31:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../.cache/pypoetry/virtualenvs/api-S2mtXI53-py3.8/lib/python3.8/site-packages/flask_sqlalchemy/extension.py:642: in engine
return self.engines[None]
../../../.cache/pypoetry/virtualenvs/api-S2mtXI53-py3.8/lib/python3.8/site-packages/flask_sqlalchemy/extension.py:628: in engines
app = current_app._get_current_object() # type: ignore[attr-defined]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
def _get_current_object() -> T:
try:
obj = local.get() # type: ignore[union-attr]
except LookupError:
> raise RuntimeError(unbound_message) from None
E RuntimeError: Working outside of application context.
E
```
Also the `create_scoped_session` method seems to have gone.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.