Hi Ronny, > i wonder what would be a good way to test the handling of unimportable > modules or fallbacks for missing modules. > i don't have any initial idea on how to get started with that.
what i usually do is to provide the to-be-unimportable module but put e.g. "raise ImportError()" into it. Using the 'tmpdir' and 'monkeypatch' funcargs makes it easy to do this, e.g.: def test_unimportable(tmpdir, monkeypatch): tmpdir.join("docutils.py").write("raise ImportError()") monkeypatch.setattr(sys, 'path', [str(tmpdir)] + sys.path) ..call-and-assert.. hth, holger _______________________________________________ py-dev mailing list py-dev@codespeak.net http://codespeak.net/mailman/listinfo/py-dev