| 225 | |
| 226 | |
| 227 | def test_import_string_attribute_error(tmpdir, monkeypatch): |
| 228 | monkeypatch.syspath_prepend(str(tmpdir)) |
| 229 | tmpdir.join("foo_test.py").write("from bar_test import value") |
| 230 | tmpdir.join("bar_test.py").write("raise AttributeError('bad')") |
| 231 | |
| 232 | with pytest.raises(AttributeError) as info: |
| 233 | utils.import_string("foo_test") |
| 234 | |
| 235 | assert "bad" in str(info.value) |
| 236 | |
| 237 | with pytest.raises(AttributeError) as info: |
| 238 | utils.import_string("bar_test") |
| 239 | |
| 240 | assert "bad" in str(info.value) |
| 241 | |
| 242 | |
| 243 | def test_find_modules(): |