<s> """<STR_LIT>""" <EOL> import pytest <EOL> from flask import json <EOL> from werkzeug import cached_property <EOL> from . fixtures import ( <EOL> client , config , accept_json , accept_jsonp , accept_any , accept_mimetype , <EOL> client_class , live_server , request_ctx <EOL> ) <EOL> class JSONResponse ( object ) : <EOL> """<STR_LIT>""" <EOL> @ cached_property <EOL> def json ( self ) : <EOL> """<STR_LIT>""" <EOL> return json . loads ( self . data ) <EOL> def _make_test_response_class ( response_class ) : <EOL> """<STR_LIT>""" <EOL> if '<STR_LIT>' in response_class . __dict__ : <EOL> return response_class <EOL> return type ( str ( JSONResponse ) , ( response_class , JSONResponse ) , { } ) <EOL> @ pytest . fixture ( autouse = True ) <EOL> def _monkeypatch_response_class ( request , monkeypatch ) : <EOL> """<STR_LIT>""" <EOL> if '<STR_LIT>' not in request . fixturenames : <EOL> return <EOL> app = request . getfuncargvalue ( '<STR_LIT>' ) <EOL> monkeypatch . setattr ( app , '<STR_LIT>' , <EOL> _make_test_response_class ( app . response_class ) ) <EOL> @ pytest . fixture ( autouse = True ) <EOL> def _push_request_context ( request ) : <EOL> """<STR_LIT>""" <EOL> if '<STR_LIT>' not in request . fixturenames : <EOL> return <EOL> app = request . getfuncargvalue ( '<STR_LIT>' ) <EOL> if '<STR_LIT>' in request . fixturenames : <EOL> app = request . getfuncargvalue ( '<STR_LIT>' ) . app <EOL> ctx = app . test_request_context ( ) <EOL> ctx . push ( ) <EOL> def teardown ( ) : <EOL> ctx . pop ( ) <EOL> request . addfinalizer ( teardown ) <EOL> @ pytest . fixture ( autouse = True ) <EOL> def _configure_application ( request , monkeypatch ) : <EOL> """<STR_LIT>""" <EOL> if '<STR_LIT>' not in request . fixturenames : <EOL> return <EOL> app = request . getfuncargvalue ( '<STR_LIT>' ) <EOL> options = request . keywords . get ( '<STR_LIT>' ) <EOL> if options is not None : <EOL> for key , value in options . kwargs . items ( ) : <EOL> monkeypatch . setitem ( app . config , key . upper ( ) , value ) <EOL> def pytest_addoption ( parser ) : <EOL> group = parser . getgroup ( '<STR_LIT>' ) <EOL> group . addoption ( '<STR_LIT>' , <EOL> action = "<STR_LIT:store_true>" , dest = "<STR_LIT>" , default = True , <EOL> help = "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> group . addoption ( '<STR_LIT>' , <EOL> action = "<STR_LIT>" , dest = "<STR_LIT>" , <EOL> help = "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> def pytest_configure ( config ) : <EOL> config . addinivalue_line ( <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' ) </s>
