| 212 | |
| 213 | |
| 214 | def 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 | |
| 230 | def test_find_modules(): |