test_proper_test_request_context() — flask Function Reference
Architecture documentation for the test_proper_test_request_context() function in test_reqctx.py from the flask codebase.
Entity Profile
Dependency Diagram
graph TD 19e4c552_ab83_9964_0a07_b6da6a1218c6["test_proper_test_request_context()"] aea65cbf_db83_bd4f_d83f_1a35ae104254["test_reqctx.py"] 19e4c552_ab83_9964_0a07_b6da6a1218c6 -->|defined in| aea65cbf_db83_bd4f_d83f_1a35ae104254 style 19e4c552_ab83_9964_0a07_b6da6a1218c6 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
tests/test_reqctx.py lines 63–104
def test_proper_test_request_context(app):
app.config.update(SERVER_NAME="localhost.localdomain:5000")
@app.route("/")
def index():
return None
@app.route("/", subdomain="foo")
def sub():
return None
with app.test_request_context("/"):
assert (
flask.url_for("index", _external=True)
== "http://localhost.localdomain:5000/"
)
with app.test_request_context("/"):
assert (
flask.url_for("sub", _external=True)
== "http://foo.localhost.localdomain:5000/"
)
# suppress Werkzeug 0.15 warning about name mismatch
with warnings.catch_warnings():
warnings.filterwarnings(
"ignore", "Current server name", UserWarning, "flask.app"
)
with app.test_request_context(
"/", environ_overrides={"HTTP_HOST": "localhost"}
):
pass
app.config.update(SERVER_NAME="localhost")
with app.test_request_context("/", environ_overrides={"SERVER_NAME": "localhost"}):
pass
app.config.update(SERVER_NAME="localhost:80")
with app.test_request_context(
"/", environ_overrides={"SERVER_NAME": "localhost:80"}
):
pass
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does test_proper_test_request_context() do?
test_proper_test_request_context() is a function in the flask codebase, defined in tests/test_reqctx.py.
Where is test_proper_test_request_context() defined?
test_proper_test_request_context() is defined in tests/test_reqctx.py at line 63.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free