Home / Function/ test_prepare_import() — flask Function Reference

test_prepare_import() — flask Function Reference

Architecture documentation for the test_prepare_import() function in test_cli.py from the flask codebase.

Entity Profile

Dependency Diagram

graph TD
  c3126cda_fb5a_2f7f_bf7d_b5fc223ae54a["test_prepare_import()"]
  62c63da0_a9c3_ab0a_4c48_a9413eac90e3["test_cli.py"]
  c3126cda_fb5a_2f7f_bf7d_b5fc223ae54a -->|defined in| 62c63da0_a9c3_ab0a_4c48_a9413eac90e3
  style c3126cda_fb5a_2f7f_bf7d_b5fc223ae54a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_cli.py lines 161–177

def test_prepare_import(request, value, path, result):
    """Expect the correct path to be set and the correct import and app names
    to be returned.

    :func:`prepare_exec_for_file` has a side effect where the parent directory
    of the given import is added to :data:`sys.path`. This is reset after the
    test runs.
    """
    original_path = sys.path[:]

    def reset_path():
        sys.path[:] = original_path

    request.addfinalizer(reset_path)

    assert prepare_import(value) == result
    assert sys.path[0] == str(path)

Subdomains

Defined In

Frequently Asked Questions

What does test_prepare_import() do?
test_prepare_import() is a function in the flask codebase, defined in tests/test_cli.py.
Where is test_prepare_import() defined?
test_prepare_import() is defined in tests/test_cli.py at line 161.

Analyze Your Own Codebase

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

Try Supermodel Free