avoid importing "py.test" (an old alias module for "pytest")
This commit is contained in:
parent
07e76cbef2
commit
a811fabb43
|
@ -98,6 +98,7 @@ NEXT (2.6)
|
||||||
- fix issue512: show "<notset>" for arguments which might not be set
|
- fix issue512: show "<notset>" for arguments which might not be set
|
||||||
in monkeypatch plugin. Improves output in documentation.
|
in monkeypatch plugin. Improves output in documentation.
|
||||||
|
|
||||||
|
- avoid importing "py.test" (an old alias module for "pytest")
|
||||||
|
|
||||||
2.5.2
|
2.5.2
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
|
|
|
@ -823,7 +823,8 @@ class Config(object):
|
||||||
if default is not notset:
|
if default is not notset:
|
||||||
return default
|
return default
|
||||||
if skip:
|
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,))
|
raise ValueError("no option named %r" % (name,))
|
||||||
|
|
||||||
def getvalue(self, name, path=None):
|
def getvalue(self, name, path=None):
|
||||||
|
|
|
@ -137,7 +137,8 @@ class PluginManager(object):
|
||||||
|
|
||||||
def skipifmissing(self, name):
|
def skipifmissing(self, name):
|
||||||
if not self.hasplugin(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):
|
def hasplugin(self, name):
|
||||||
return bool(self.getplugin(name))
|
return bool(self.getplugin(name))
|
||||||
|
@ -220,10 +221,9 @@ class PluginManager(object):
|
||||||
return self.import_plugin(modname[7:])
|
return self.import_plugin(modname[7:])
|
||||||
raise
|
raise
|
||||||
except:
|
except:
|
||||||
|
import pytest
|
||||||
e = py.std.sys.exc_info()[1]
|
e = py.std.sys.exc_info()[1]
|
||||||
if not hasattr(py.test, 'skip'):
|
if not hasattr(pytest, 'skip') or not isinstance(e, pytest.skip.Exception):
|
||||||
raise
|
|
||||||
elif not isinstance(e, py.test.skip.Exception):
|
|
||||||
raise
|
raise
|
||||||
self._warnings.append("skipped plugin %r: %s" %((modname, e.msg)))
|
self._warnings.append("skipped plugin %r: %s" %((modname, e.msg)))
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue