use non-hacky dynamic package import method
This commit is contained in:
parent
1c817aa7bd
commit
64c7c1be15
|
@ -321,13 +321,15 @@ def importplugin(importspec):
|
||||||
name = importspec
|
name = importspec
|
||||||
try:
|
try:
|
||||||
mod = "_pytest." + name
|
mod = "_pytest." + name
|
||||||
return __import__(mod, None, None, '__doc__')
|
__import__(mod)
|
||||||
|
return sys.modules[mod]
|
||||||
except ImportError:
|
except ImportError:
|
||||||
#e = py.std.sys.exc_info()[1]
|
#e = py.std.sys.exc_info()[1]
|
||||||
#if str(e).find(name) == -1:
|
#if str(e).find(name) == -1:
|
||||||
# raise
|
# raise
|
||||||
pass #
|
pass #
|
||||||
return __import__(importspec, None, None, '__doc__')
|
__import__(importspec)
|
||||||
|
return sys.modules[importspec]
|
||||||
|
|
||||||
class MultiCall:
|
class MultiCall:
|
||||||
""" execute a call into multiple python functions/methods. """
|
""" execute a call into multiple python functions/methods. """
|
||||||
|
|
|
@ -416,9 +416,10 @@ def importorskip(modname, minversion=None):
|
||||||
__tracebackhide__ = True
|
__tracebackhide__ = True
|
||||||
compile(modname, '', 'eval') # to catch syntaxerrors
|
compile(modname, '', 'eval') # to catch syntaxerrors
|
||||||
try:
|
try:
|
||||||
mod = __import__(modname, None, None, ['__doc__'])
|
__import__(modname)
|
||||||
except ImportError:
|
except ImportError:
|
||||||
py.test.skip("could not import %r" %(modname,))
|
py.test.skip("could not import %r" %(modname,))
|
||||||
|
mod = sys.modules[modname]
|
||||||
if minversion is None:
|
if minversion is None:
|
||||||
return mod
|
return mod
|
||||||
verattr = getattr(mod, '__version__', None)
|
verattr = getattr(mod, '__version__', None)
|
||||||
|
|
Loading…
Reference in New Issue