TestNoImports Class — flask Architecture
Architecture documentation for the TestNoImports class in test_helpers.py from the flask codebase.
Entity Profile
Dependency Diagram
graph TD cd18a2c8_818e_f563_8b1e_4d34a3accdce["TestNoImports"] d5d22f74_a243_4ea9_9dfe_aaec71d26288["test_helpers.py"] cd18a2c8_818e_f563_8b1e_4d34a3accdce -->|defined in| d5d22f74_a243_4ea9_9dfe_aaec71d26288 6b99cb6e_b5dd_e28d_aa39_923b63c98d83["test_name_with_import_error()"] cd18a2c8_818e_f563_8b1e_4d34a3accdce -->|method| 6b99cb6e_b5dd_e28d_aa39_923b63c98d83
Relationship Graph
Source Code
tests/test_helpers.py lines 217–233
class TestNoImports:
"""Test Flasks are created without import.
Avoiding ``__import__`` helps create Flask instances where there are errors
at import time. Those runtime errors will be apparent to the user soon
enough, but tools which build Flask instances meta-programmatically benefit
from a Flask which does not ``__import__``. Instead of importing to
retrieve file paths or metadata on a module or package, use the pkgutil and
imp modules in the Python standard library.
"""
def test_name_with_import_error(self, modules_tmp_path):
(modules_tmp_path / "importerror.py").write_text("raise NotImplementedError()")
try:
flask.Flask("importerror")
except NotImplementedError:
AssertionError("Flask(import_name) is importing import_name.")
Defined In
Source
Frequently Asked Questions
What is the TestNoImports class?
TestNoImports is a class in the flask codebase, defined in tests/test_helpers.py.
Where is TestNoImports defined?
TestNoImports is defined in tests/test_helpers.py at line 217.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free