diff --git a/CHANGELOG b/CHANGELOG index a29cc9022..63aa51500 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -98,6 +98,7 @@ NEXT (2.6) - fix issue512: show "" for arguments which might not be set in monkeypatch plugin. Improves output in documentation. +- avoid importing "py.test" (an old alias module for "pytest") 2.5.2 ----------------------------------- diff --git a/_pytest/config.py b/_pytest/config.py index 755fdeb23..51f178862 100644 --- a/_pytest/config.py +++ b/_pytest/config.py @@ -823,7 +823,8 @@ class Config(object): if default is not notset: return default if skip: - py.test.skip("no %r option found" %(name,)) + import pytest + pytest.skip("no %r option found" %(name,)) raise ValueError("no option named %r" % (name,)) def getvalue(self, name, path=None): diff --git a/_pytest/core.py b/_pytest/core.py index 50af3188d..f514eaf3b 100644 --- a/_pytest/core.py +++ b/_pytest/core.py @@ -137,7 +137,8 @@ class PluginManager(object): def skipifmissing(self, name): if not self.hasplugin(name): - py.test.skip("plugin %r is missing" % name) + import pytest + pytest.skip("plugin %r is missing" % name) def hasplugin(self, name): return bool(self.getplugin(name)) @@ -220,10 +221,9 @@ class PluginManager(object): return self.import_plugin(modname[7:]) raise except: + import pytest e = py.std.sys.exc_info()[1] - if not hasattr(py.test, 'skip'): - raise - elif not isinstance(e, py.test.skip.Exception): + if not hasattr(pytest, 'skip') or not isinstance(e, pytest.skip.Exception): raise self._warnings.append("skipped plugin %r: %s" %((modname, e.msg))) else: