enhance skip except clause by directly using the Skipped exception
This commit is contained in:
parent
ade7ad25c7
commit
fbf01bd31a
|
@ -11,6 +11,8 @@ import py
|
||||||
# DON't import pytest here because it causes import cycle troubles
|
# DON't import pytest here because it causes import cycle troubles
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
|
from _pytest.outcomes import Skipped
|
||||||
|
|
||||||
import _pytest._code
|
import _pytest._code
|
||||||
import _pytest.hookspec # the extension point definitions
|
import _pytest.hookspec # the extension point definitions
|
||||||
import _pytest.assertion
|
import _pytest.assertion
|
||||||
|
@ -435,10 +437,7 @@ class PytestPluginManager(PluginManager):
|
||||||
|
|
||||||
six.reraise(new_exc_type, new_exc, sys.exc_info()[2])
|
six.reraise(new_exc_type, new_exc, sys.exc_info()[2])
|
||||||
|
|
||||||
except Exception as e:
|
except Skipped as e:
|
||||||
import pytest
|
|
||||||
if not hasattr(pytest, 'skip') or not isinstance(e, pytest.skip.Exception):
|
|
||||||
raise
|
|
||||||
self._warn("skipped plugin %r: %s" % ((modname, e.msg)))
|
self._warn("skipped plugin %r: %s" % ((modname, e.msg)))
|
||||||
else:
|
else:
|
||||||
mod = sys.modules[importspec]
|
mod = sys.modules[importspec]
|
||||||
|
|
Loading…
Reference in New Issue