MCPcopy Create free account
hub / github.com/pallets/flask / test_prepare_import

Function test_prepare_import

tests/test_cli.py:161–177  ·  view source on GitHub ↗

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.

(request, value, path, result)

Source from the content-addressed store, hash-verified

159 ),
160)
161def test_prepare_import(request, value, path, result):
162 """Expect the correct path to be set and the correct import and app names
163 to be returned.
164
165 :func:`prepare_exec_for_file` has a side effect where the parent directory
166 of the given import is added to :data:`sys.path`. This is reset after the
167 test runs.
168 """
169 original_path = sys.path[:]
170
171 def reset_path():
172 sys.path[:] = original_path
173
174 request.addfinalizer(reset_path)
175
176 assert prepare_import(value) == result
177 assert sys.path[0] == str(path)
178
179
180@pytest.mark.parametrize(

Callers

nothing calls this directly

Calls 1

prepare_importFunction · 0.90

Tested by

no test coverage detected