refine and extend custom error reporting particularly for collection-related errors

--HG--
branch : trunk
This commit is contained in:
holger krekel
2010-07-04 17:06:50 +02:00
parent e533e63bbf
commit f9c5b00ffa
12 changed files with 108 additions and 28 deletions

View File

@@ -360,10 +360,13 @@ class TestImport:
pseudopath = tmpdir.ensure(name+"123.py")
mod.__file__ = str(pseudopath)
monkeypatch.setitem(sys.modules, name, mod)
excinfo = py.test.raises(EnvironmentError, "p.pyimport()")
s = str(excinfo.value)
assert "mismatch" in s
assert name+"123" in s
excinfo = py.test.raises(pseudopath.ImportMismatchError,
"p.pyimport()")
modname, modfile, orig = excinfo.value.args
assert modname == name
assert modfile == pseudopath
assert orig == p
assert issubclass(pseudopath.ImportMismatchError, ImportError)
def test_pypkgdir(tmpdir):
pkg = tmpdir.ensure('pkg1', dir=1)