Skip to content
Myr

use app.testing property instead of config

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by David Lord · committed by David Lord · parent 07a7058 · Browse files · 1 file+5 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+5 added−3 removed

  • other:+5 added−3 removed

1 file+5 added−3 removed

modified:docs/testing.rst+5 added-3 removed
39 unmodified lines
40 class FlaskrTestCase(unittest.TestCase):4142 def setUp(self):43 self.db_fd, flaskr.app.config['DATABASE'] = tempfile.mkstemp()44 flaskr.app.config['TESTING'] = True44 flaskr.app.testing = True45 self.app = flaskr.app.test_client()46 with flaskr.app.app_context():47 flaskr.init_db()48
48 unmodified lines
97 class FlaskrTestCase(unittest.TestCase):9899 def setUp(self):100 self.db_fd, flaskr.app.config['DATABASE'] = tempfile.mkstemp()101 flaskr.app.testing = True102 self.app = flaskr.app.test_client()103 with flaskr.app.app_context():102 flaskr.init_db()104 flaskr.init_db()105106 def tearDown(self):107 os.close(self.db_fd)108 os.unlink(flaskr.app.config['DATABASE'])
100 unmodified lines
209:class:`~flask.g` and :class:`~flask.session` objects like in view210functions. Here is a full example that demonstrates this approach::211212 import flask211 213214 app = flask.Flask(__name__)215216 with app.test_request_context('/?name=Peter'):217 assert flask.request.path == '/'
140 unmodified lines