Home / File/ test_testing.py — flask Source File

test_testing.py — flask Source File

Architecture documentation for test_testing.py, a python file in the flask codebase. 8 imports, 0 dependents.

File python ApplicationCore AppLifeCycle 8 imports 25 functions 3 classes

Entity Profile

Dependency Diagram

graph LR
  8c162ff0_0a8a_d943_77b6_c07b38d297a0["test_testing.py"]
  7d9ebc53_a992_d150_c79b_39c114a84acf["importlib.metadata"]
  8c162ff0_0a8a_d943_77b6_c07b38d297a0 --> 7d9ebc53_a992_d150_c79b_39c114a84acf
  2681878a_119e_c28f_8e5e_e924c75161c4["click"]
  8c162ff0_0a8a_d943_77b6_c07b38d297a0 --> 2681878a_119e_c28f_8e5e_e924c75161c4
  da94d511_b8b8_a450_f67f_fc28ea9b648a["pytest"]
  8c162ff0_0a8a_d943_77b6_c07b38d297a0 --> da94d511_b8b8_a450_f67f_fc28ea9b648a
  8c762fc5_c0b6_0d4d_3889_896d80fbf225["flask"]
  8c162ff0_0a8a_d943_77b6_c07b38d297a0 --> 8c762fc5_c0b6_0d4d_3889_896d80fbf225
  a7296d2c_84d8_0e72_9e54_0192cfc80c5d["flask.cli"]
  8c162ff0_0a8a_d943_77b6_c07b38d297a0 --> a7296d2c_84d8_0e72_9e54_0192cfc80c5d
  3e36f42e_6b7c_ad20_fe7e_3ce2e69941e4["flask.globals"]
  8c162ff0_0a8a_d943_77b6_c07b38d297a0 --> 3e36f42e_6b7c_ad20_fe7e_3ce2e69941e4
  acf3e737_5909_3be8_9bd2_e20a89bbde96["flask.json"]
  8c162ff0_0a8a_d943_77b6_c07b38d297a0 --> acf3e737_5909_3be8_9bd2_e20a89bbde96
  2a2a4b0c_ad5b_b59a_8848_4f7c42fd9bbe["flask.testing"]
  8c162ff0_0a8a_d943_77b6_c07b38d297a0 --> 2a2a4b0c_ad5b_b59a_8848_4f7c42fd9bbe
  style 8c162ff0_0a8a_d943_77b6_c07b38d297a0 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import importlib.metadata

import click
import pytest

import flask
from flask import appcontext_popped
from flask.cli import ScriptInfo
from flask.globals import _cv_app
from flask.json import jsonify
from flask.testing import EnvironBuilder
from flask.testing import FlaskCliRunner


def test_environ_defaults_from_config(app, client):
    app.config["SERVER_NAME"] = "example.com:1234"
    app.config["APPLICATION_ROOT"] = "/foo"

    @app.route("/")
    def index():
        return flask.request.url

    ctx = app.test_request_context()
    assert ctx.request.url == "http://example.com:1234/foo/"

    rv = client.get("/")
    assert rv.data == b"http://example.com:1234/foo/"


def test_environ_defaults(app, client, app_ctx, req_ctx):
    @app.route("/")
    def index():
        return flask.request.url

    ctx = app.test_request_context()
    assert ctx.request.url == "http://localhost/"
    with client:
        rv = client.get("/")
        assert rv.data == b"http://localhost/"


def test_environ_base_default(app, client):
    @app.route("/")
    def index():
        flask.g.remote_addr = flask.request.remote_addr
        flask.g.user_agent = flask.request.user_agent.string
        return ""

    with client:
        client.get("/")
        assert flask.g.remote_addr == "127.0.0.1"
        assert flask.g.user_agent == (
            f"Werkzeug/{importlib.metadata.version('werkzeug')}"
        )


def test_environ_base_modified(app, client):
    @app.route("/")
    def index():
        flask.g.remote_addr = flask.request.remote_addr
// ... (326 more lines)

Subdomains

Dependencies

  • click
  • flask
  • flask.cli
  • flask.globals
  • flask.json
  • flask.testing
  • importlib.metadata
  • pytest

Frequently Asked Questions

What does test_testing.py do?
test_testing.py is a source file in the flask codebase, written in python. It belongs to the ApplicationCore domain, AppLifeCycle subdomain.
What functions are defined in test_testing.py?
test_testing.py defines 25 function(s): test_blueprint_with_subdomain, test_cli_custom_obj, test_cli_invoke, test_cli_runner_class, test_client_json_no_app_context, test_client_open_environ, test_client_pop_all_preserved, test_environ_base_default, test_environ_base_modified, test_environ_defaults, and 15 more.
What does test_testing.py depend on?
test_testing.py imports 8 module(s): click, flask, flask.cli, flask.globals, flask.json, flask.testing, importlib.metadata, pytest.
Where is test_testing.py in the architecture?
test_testing.py is located at tests/test_testing.py (domain: ApplicationCore, subdomain: AppLifeCycle, directory: tests).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free