diff --git a/tests/test_templating.py b/tests/test_templating.py index b60a592a..e65fe834 100644 --- a/tests/test_templating.py +++ b/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