This commit is contained in:
Markus Unterwaditzer 2014-09-03 20:50:54 +02:00
parent e77bc2d86c
commit d0cf5ef394
6 changed files with 497 additions and 520 deletions

View file

@ -6,12 +6,34 @@
:copyright: (c) 2014 by the Flask Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
import flask
import os
import sys
import pkgutil
import pytest
import sys
import textwrap
@pytest.fixture(autouse=True)
def setup_path(monkeypatch):
monkeypatch.syspath_prepend(
os.path.abspath(os.path.join(
os.path.dirname(__file__), 'test_apps'))
)
@pytest.fixture(autouse=True)
def leak_detector(request):
def ensure_clean_request_context():
# make sure we're not leaking a request context since we are
# testing flask internally in debug mode in a few cases
leaks = []
while flask._request_ctx_stack.top is not None:
leaks.append(flask._request_ctx_stack.pop())
assert leaks == []
request.addfinalizer(ensure_clean_request_context)
@pytest.fixture(params=(True, False))
def limit_loader(request, monkeypatch):
"""Patch pkgutil.get_loader to give loader without get_filename or archive.