test_db.py
This file
Path
examples/tutorial/tests/test_db.py
29 lines · 624 bytes · Python
Last changed by
Merge branch '1.0.x'David Lordbefore adoptionb05a685
History of this fileTake it
The walk stopped after 200 commits: lines older than 3a0ea72 point at it.
move coveragerc to setup.cfgDavid Lordbefore adoption3a0ea72
lines 1–3why, one step back1import sqlite323import pytestMerge pull request #3246 from pallets/reorder-importsDavid Lordbefore adoption3db4697
line 4why, one step back4move coveragerc to setup.cfgDavid Lordbefore adoption3a0ea72
lines 5–13why, 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:Merge pull request #3183 from singingwolfboy/pre-commitDavid Baumgoldbefore adoption1dda032
line 14why, one step back14 db.execute("SELECT 1")move coveragerc to setup.cfgDavid Lordbefore adoption3a0ea72
line 15why, one step back15Merge branch '1.0.x'David Lordbefore adoptionb05a685
line 16why, one step back16 assert "closed" in str(e.value)move coveragerc to setup.cfgDavid Lordbefore adoption3a0ea72
lines 17–25why, one step back171819def test_init_db_command(runner, monkeypatch):20 class Recorder(object):21 called = False2223 def fake_init_db():24 Recorder.called = True25Merge pull request #3183 from singingwolfboy/pre-commitDavid Baumgoldbefore adoption1dda032
lines 26–28why, one step back26 monkeypatch.setattr("flaskr.db.init_db", fake_init_db)27 result = runner.invoke(args=["init-db"])28 assert "Initialized" in result.outputmove coveragerc to setup.cfgDavid Lordbefore adoption3a0ea72
line 29why, one step back29 assert Recorder.called