test_db.py
This file
Path
examples/tutorial/tests/test_db.py
29 lines · 616 bytes · Python
Last changed by
Merge pull request #3554 from pallets/drop-python2David Lordbefore adoptioncd8a374
History of this fileTake it
The walk stopped after 200 commits: lines older than 754b729 point at it.
Merge pull request #3124 from elbeardmorez/fix_static_url_pathDavid Lordbefore adoption754b729
lines 1–3why, one step back1import sqlite323import pytestMerge pull request #3246 from pallets/reorder-importsDavid Lordbefore adoption3db4697
line 4why, one step back4Merge pull request #3124 from elbeardmorez/fix_static_url_pathDavid Lordbefore adoption754b729
lines 5–15why, one step back5from flaskr.db import get_db678def test_get_close_db(app):9 with app.app_context():10 db = get_db()11 assert db is get_db()1213 with pytest.raises(sqlite3.ProgrammingError) as e:14 db.execute("SELECT 1")15Merge branch '1.0.x'David Lordbefore adoptionb05a685
line 16why, one step back16 assert "closed" in str(e.value)Merge pull request #3124 from elbeardmorez/fix_static_url_pathDavid Lordbefore adoption754b729
lines 17–19why, one step back171819def test_init_db_command(runner, monkeypatch):Merge pull request #3554 from pallets/drop-python2David Lordbefore adoptioncd8a374
line 20why, one step back20 class Recorder:Merge pull request #3124 from elbeardmorez/fix_static_url_pathDavid Lordbefore adoption754b729
lines 21–29why, one step back21 called = False2223 def fake_init_db():24 Recorder.called = True2526 monkeypatch.setattr("flaskr.db.init_db", fake_init_db)27 result = runner.invoke(args=["init-db"])28 assert "Initialized" in result.output29 assert Recorder.called