Browse Source

Add test for new template auto reload debug behaviour

pull/1910/head
Dave Barker 9 years ago
parent
commit
24289e97af
  1. 17
      tests/test_templating.py

17
tests/test_templating.py

@ -14,6 +14,7 @@ import pytest
import flask
import logging
from jinja2 import TemplateNotFound
import werkzeug.serving
def test_context_processing():
@ -346,6 +347,22 @@ def test_templates_auto_reload():
app.config['TEMPLATES_AUTO_RELOAD'] = True
assert app.jinja_env.auto_reload is True
def test_templates_auto_reload_debug_run(monkeypatch):
# debug is None in config, config option is None, app.run(debug=True)
rv = {}
# Mocks werkzeug.serving.run_simple method
def run_simple_mock(*args, **kwargs):
rv['passthrough_errors'] = kwargs.get('passthrough_errors')
app = flask.Flask(__name__)
monkeypatch.setattr(werkzeug.serving, 'run_simple', run_simple_mock)
assert app.config['TEMPLATES_AUTO_RELOAD'] is None
assert app.jinja_env.auto_reload is False
app.run(debug=True)
assert app.jinja_env.auto_reload is True
def test_template_loader_debugging(test_apps):
from blueprintapp import app

Loading…
Cancel
Save