diff --git a/_pytest/core.py b/_pytest/core.py index eabade7ec..15ce9f4cc 100644 --- a/_pytest/core.py +++ b/_pytest/core.py @@ -321,13 +321,15 @@ def importplugin(importspec): name = importspec try: mod = "_pytest." + name - return __import__(mod, None, None, '__doc__') + __import__(mod) + return sys.modules[mod] except ImportError: #e = py.std.sys.exc_info()[1] #if str(e).find(name) == -1: # raise pass # - return __import__(importspec, None, None, '__doc__') + __import__(importspec) + return sys.modules[importspec] class MultiCall: """ execute a call into multiple python functions/methods. """ diff --git a/_pytest/runner.py b/_pytest/runner.py index f9f203ffa..cac63f252 100644 --- a/_pytest/runner.py +++ b/_pytest/runner.py @@ -416,9 +416,10 @@ def importorskip(modname, minversion=None): __tracebackhide__ = True compile(modname, '', 'eval') # to catch syntaxerrors try: - mod = __import__(modname, None, None, ['__doc__']) + __import__(modname) except ImportError: py.test.skip("could not import %r" %(modname,)) + mod = sys.modules[modname] if minversion is None: return mod verattr = getattr(mod, '__version__', None)