def test_consider_module(self): plugins = PyPlugins() mod = py.std.new.module("temp") mod.pylib = ["xxx nomod"] excinfo = py.test.raises(ImportError, "plugins.consider_module(mod)") mod.pylib = "os" class Events(list): def pyevent_importingmodule(self, mod): self.append(mod) l = Events() plugins.register(l) plugins.consider_module(mod) assert len(l) == 1 assert l[0] == (mod.pylib)