MCPcopy
hub / github.com/pallets/werkzeug / test_import_string_attribute_error

Function test_import_string_attribute_error

tests/test_utils.py:214–227  ·  view source on GitHub ↗
(tmpdir, monkeypatch)

Source from the content-addressed store, hash-verified

212
213
214def test_import_string_attribute_error(tmpdir, monkeypatch):
215 monkeypatch.syspath_prepend(str(tmpdir))
216 tmpdir.join("foo_test.py").write("from bar_test import value")
217 tmpdir.join("bar_test.py").write("raise AttributeError('bad')")
218
219 with pytest.raises(AttributeError) as info:
220 utils.import_string("foo_test")
221
222 assert "bad" in str(info.value)
223
224 with pytest.raises(AttributeError) as info:
225 utils.import_string("bar_test")
226
227 assert "bad" in str(info.value)
228
229
230def test_find_modules():

Callers

nothing calls this directly

Calls 1

writeMethod · 0.45

Tested by

no test coverage detected