Home / Function/ _standard_os_environ() — flask Function Reference

_standard_os_environ() — flask Function Reference

Architecture documentation for the _standard_os_environ() function in conftest.py from the flask codebase.

Entity Profile

Dependency Diagram

graph TD
  924df959_8c45_a83c_8c25_c40d54bcc1a1["_standard_os_environ()"]
  91da8911_f5f3_2fff_0b5f_8e0f6b24cbf6["conftest.py"]
  924df959_8c45_a83c_8c25_c40d54bcc1a1 -->|defined in| 91da8911_f5f3_2fff_0b5f_8e0f6b24cbf6
  style 924df959_8c45_a83c_8c25_c40d54bcc1a1 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/conftest.py lines 12–33

def _standard_os_environ():
    """Set up ``os.environ`` at the start of the test session to have
    standard values. Returns a list of operations that is used by
    :func:`._reset_os_environ` after each test.
    """
    mp = monkeypatch.MonkeyPatch()
    out = (
        (os.environ, "FLASK_ENV_FILE", monkeypatch.notset),
        (os.environ, "FLASK_APP", monkeypatch.notset),
        (os.environ, "FLASK_DEBUG", monkeypatch.notset),
        (os.environ, "FLASK_RUN_FROM_CLI", monkeypatch.notset),
        (os.environ, "WERKZEUG_RUN_MAIN", monkeypatch.notset),
    )

    for _, key, value in out:
        if value is monkeypatch.notset:
            mp.delenv(key, False)
        else:
            mp.setenv(key, value)

    yield out
    mp.undo()

Subdomains

Defined In

Frequently Asked Questions

What does _standard_os_environ() do?
_standard_os_environ() is a function in the flask codebase, defined in tests/conftest.py.
Where is _standard_os_environ() defined?
_standard_os_environ() is defined in tests/conftest.py at line 12.

Analyze Your Own Codebase

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

Try Supermodel Free