avoid importing "py.test" (an old alias module for "pytest")

This commit is contained in:
holger krekel 2014-07-03 12:58:12 +02:00
parent 07e76cbef2
commit a811fabb43
3 changed files with 7 additions and 5 deletions

View File

@ -98,6 +98,7 @@ NEXT (2.6)
- fix issue512: show "<notset>" 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
-----------------------------------

View File

@ -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):

View File

@ -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: