jeancochrane / jeancochrane/pytest-flask-sqlalchemy
Is pytest-flask-sqlalchemy working with module scoped fixtures?
- Dominant language
- Python
- Stars
- 253
- Forks
- 45
- PR merge metrics
- No merged PRs in 30d
Description
I want to use pytest-flask-sqlalchemy with fixtures with `scope='module'`
For example i have creating user:
```python
@pytest.fixture(scope='module')
def user(db_session):
user = User(
username='My user',
)
db_session.add(user)
db_session.commit()
return user
```
Then when i testing some functions, after changing user, i get `Instance not bound to session` exception
Example of changing user fixture:
```python
@pytest.fixture
def user_with_other_username(db_session, user):
user.username='Other username'
db_session.add(user)
db_session.commit()
return user
```
I got this exception when `user` fixture has module scope. When i set function scope i hasn`t exception
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.