{"library":"pytest-flask-sqlalchemy","title":"pytest-flask-sqlalchemy","description":"A pytest plugin that provides fixtures to preserve test isolation in Flask-SQLAlchemy by using database transactions. It simplifies testing Flask applications with SQLAlchemy by allowing tests to roll back changes automatically. Current version is 1.1.0, with a release cadence of irregular minor updates.","language":"python","status":"active","last_verified":"Fri May 01","install":{"commands":["pip install pytest-flask-sqlalchemy"],"cli":null},"imports":["import pytest_flask_sqlalchemy"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import pytest\n\n@pytest.fixture\ndef app():\n    from myapp import create_app\n    app = create_app()\n    app.config['TESTING'] = True\n    app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///:memory:'\n    return app\n\n@pytest.fixture\ndef db(app):\n    from myapp import db\n    db.init_app(app)\n    with app.app_context():\n        db.create_all()\n    yield db\n    db.drop_all()\n\ndef test_something(db):\n    # db.session is managed by plugin\n    assert True","lang":"python","description":"Basic setup with custom app and db fixtures; plugin ensures transaction rollback after each test.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}