From fbf01bd31a49e41b0fb2a1e3f874c5c1bfa433c9 Mon Sep 17 00:00:00 2001 From: Ronny Pfannschmidt Date: Tue, 6 Mar 2018 10:29:26 +0100 Subject: [PATCH] enhance skip except clause by directly using the Skipped exception --- _pytest/config.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/_pytest/config.py b/_pytest/config.py index 908c5bf5a..fe6e324a5 100644 --- a/_pytest/config.py +++ b/_pytest/config.py @@ -11,6 +11,8 @@ import py # DON't import pytest here because it causes import cycle troubles import sys import os +from _pytest.outcomes import Skipped + import _pytest._code import _pytest.hookspec # the extension point definitions import _pytest.assertion @@ -435,10 +437,7 @@ class PytestPluginManager(PluginManager): six.reraise(new_exc_type, new_exc, sys.exc_info()[2]) - except Exception as e: - import pytest - if not hasattr(pytest, 'skip') or not isinstance(e, pytest.skip.Exception): - raise + except Skipped as e: self._warn("skipped plugin %r: %s" % ((modname, e.msg))) else: mod = sys.modules[importspec]