mirror of https://github.com/pallets/flask.git
test no debug flag doesn't reconfigure
test templates_auto_reload property instead of config use app fixture in test
This commit is contained in:
parent
4fc48200a5
commit
4d2a3ab2e0
|
@ -386,19 +386,19 @@ def test_templates_auto_reload(app):
|
||||||
app.config['TEMPLATES_AUTO_RELOAD'] = True
|
app.config['TEMPLATES_AUTO_RELOAD'] = True
|
||||||
assert app.jinja_env.auto_reload is True
|
assert app.jinja_env.auto_reload is True
|
||||||
|
|
||||||
def test_templates_auto_reload_debug_run(monkeypatch):
|
def test_templates_auto_reload_debug_run(app, monkeypatch):
|
||||||
# debug is None in config, config option is None, app.run(debug=True)
|
|
||||||
# Mocks werkzeug.serving.run_simple method
|
|
||||||
def run_simple_mock(*args, **kwargs):
|
def run_simple_mock(*args, **kwargs):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
app = flask.Flask(__name__)
|
|
||||||
monkeypatch.setattr(werkzeug.serving, 'run_simple', run_simple_mock)
|
monkeypatch.setattr(werkzeug.serving, 'run_simple', run_simple_mock)
|
||||||
|
|
||||||
assert app.config['TEMPLATES_AUTO_RELOAD'] is None
|
app.run()
|
||||||
assert app.jinja_env.auto_reload is False
|
assert app.templates_auto_reload == False
|
||||||
|
assert app.jinja_env.auto_reload == False
|
||||||
|
|
||||||
app.run(debug=True)
|
app.run(debug=True)
|
||||||
assert app.jinja_env.auto_reload is True
|
assert app.templates_auto_reload == True
|
||||||
|
assert app.jinja_env.auto_reload == True
|
||||||
|
|
||||||
|
|
||||||
def test_template_loader_debugging(test_apps):
|
def test_template_loader_debugging(test_apps):
|
||||||
|
|
Loading…
Reference in New Issue