test_appctx.py — flask Source File
Architecture documentation for test_appctx.py, a python file in the flask codebase. 3 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 64d09782_9311_5dea_7886_5faca96ebc84["test_appctx.py"] da94d511_b8b8_a450_f67f_fc28ea9b648a["pytest"] 64d09782_9311_5dea_7886_5faca96ebc84 --> da94d511_b8b8_a450_f67f_fc28ea9b648a 8c762fc5_c0b6_0d4d_3889_896d80fbf225["flask"] 64d09782_9311_5dea_7886_5faca96ebc84 --> 8c762fc5_c0b6_0d4d_3889_896d80fbf225 3e36f42e_6b7c_ad20_fe7e_3ce2e69941e4["flask.globals"] 64d09782_9311_5dea_7886_5faca96ebc84 --> 3e36f42e_6b7c_ad20_fe7e_3ce2e69941e4 style 64d09782_9311_5dea_7886_5faca96ebc84 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import pytest
import flask
from flask.globals import app_ctx
def test_basic_url_generation(app):
app.config["SERVER_NAME"] = "localhost"
app.config["PREFERRED_URL_SCHEME"] = "https"
@app.route("/")
def index():
pass
with app.app_context():
rv = flask.url_for("index")
assert rv == "https://localhost/"
def test_url_generation_requires_server_name(app):
with app.app_context():
with pytest.raises(RuntimeError):
flask.url_for("index")
def test_url_generation_without_context_fails():
with pytest.raises(RuntimeError):
flask.url_for("index")
def test_request_context_means_app_context(app):
with app.test_request_context():
assert flask.current_app._get_current_object() is app
assert not flask.current_app
def test_app_context_provides_current_app(app):
with app.app_context():
assert flask.current_app._get_current_object() is app
assert not flask.current_app
def test_app_tearing_down(app):
cleanup_stuff = []
@app.teardown_appcontext
def cleanup(exception):
cleanup_stuff.append(exception)
with app.app_context():
pass
assert cleanup_stuff == [None]
def test_app_tearing_down_with_previous_exception(app):
cleanup_stuff = []
@app.teardown_appcontext
def cleanup(exception):
// ... (151 more lines)
Domain
Subdomains
Functions
- test_app_context_provides_current_app()
- test_app_ctx_globals_methods()
- test_app_tearing_down()
- test_app_tearing_down_with_handled_exception_by_app_handler()
- test_app_tearing_down_with_handled_exception_by_except_block()
- test_app_tearing_down_with_previous_exception()
- test_app_tearing_down_with_unhandled_exception()
- test_basic_url_generation()
- test_clean_pop()
- test_context_refcounts()
- test_custom_app_ctx_globals_class()
- test_request_context_means_app_context()
- test_url_generation_requires_server_name()
- test_url_generation_without_context_fails()
Classes
Dependencies
- flask
- flask.globals
- pytest
Source
Frequently Asked Questions
What does test_appctx.py do?
test_appctx.py is a source file in the flask codebase, written in python. It belongs to the ApplicationCore domain, ExtensionRegistry subdomain.
What functions are defined in test_appctx.py?
test_appctx.py defines 14 function(s): test_app_context_provides_current_app, test_app_ctx_globals_methods, test_app_tearing_down, test_app_tearing_down_with_handled_exception_by_app_handler, test_app_tearing_down_with_handled_exception_by_except_block, test_app_tearing_down_with_previous_exception, test_app_tearing_down_with_unhandled_exception, test_basic_url_generation, test_clean_pop, test_context_refcounts, and 4 more.
What does test_appctx.py depend on?
test_appctx.py imports 3 module(s): flask, flask.globals, pytest.
Where is test_appctx.py in the architecture?
test_appctx.py is located at tests/test_appctx.py (domain: ApplicationCore, subdomain: ExtensionRegistry, directory: tests).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free