Add test for new template auto reload debug behaviour
This commit is contained in:
parent
0514ba2de1
commit
24289e97af
1 changed files with 17 additions and 0 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue