test_load_dotenv() — flask Function Reference
Architecture documentation for the test_load_dotenv() function in test_cli.py from the flask codebase.
Entity Profile
Dependency Diagram
graph TD c018f806_7021_e173_5e5f_78f11ae79aed["test_load_dotenv()"] 62c63da0_a9c3_ab0a_4c48_a9413eac90e3["test_cli.py"] c018f806_7021_e173_5e5f_78f11ae79aed -->|defined in| 62c63da0_a9c3_ab0a_4c48_a9413eac90e3 style c018f806_7021_e173_5e5f_78f11ae79aed fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
tests/test_cli.py lines 536–556
def test_load_dotenv(monkeypatch):
# can't use monkeypatch.delitem since the keys don't exist yet
for item in ("FOO", "BAR", "SPAM", "HAM"):
monkeypatch._setitem.append((os.environ, item, notset))
monkeypatch.setenv("EGGS", "3")
monkeypatch.chdir(test_path)
assert load_dotenv()
assert Path.cwd() == test_path
# .flaskenv doesn't overwrite .env
assert os.environ["FOO"] == "env"
# set only in .flaskenv
assert os.environ["BAR"] == "bar"
# set only in .env
assert os.environ["SPAM"] == "1"
# set manually, files don't overwrite
assert os.environ["EGGS"] == "3"
# test env file encoding
assert os.environ["HAM"] == "火腿"
# Non existent file should not load
assert not load_dotenv("non-existent-file", load_defaults=False)
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does test_load_dotenv() do?
test_load_dotenv() is a function in the flask codebase, defined in tests/test_cli.py.
Where is test_load_dotenv() defined?
test_load_dotenv() is defined in tests/test_cli.py at line 536.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free