pytest 2.7 compatibility.
This commit is contained in:
parent
33f1ff4e8c
commit
bd9495486b
|
@ -1,4 +1,12 @@
|
||||||
|
import pytest
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from _pytest.cacheprovider import Cache
|
from _pytest.cacheprovider import Cache
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from pytest_cache import Cache
|
from pytest_cache import Cache
|
||||||
|
|
||||||
|
|
||||||
|
if hasattr(pytest, 'hookimpl'):
|
||||||
|
tryfirst = pytest.hookimpl(tryfirst=True)
|
||||||
|
else:
|
||||||
|
tryfirst = pytest.mark.tryfirst
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import pytest
|
from .compat import Cache, tryfirst
|
||||||
from .compat import Cache
|
|
||||||
|
|
||||||
|
|
||||||
def pytest_addoption(parser):
|
def pytest_addoption(parser):
|
||||||
|
@ -12,7 +11,7 @@ def pytest_addoption(parser):
|
||||||
help='ignore the first failing test but stop on the next failing test')
|
help='ignore the first failing test but stop on the next failing test')
|
||||||
|
|
||||||
|
|
||||||
@pytest.hookimpl(tryfirst=True)
|
@tryfirst
|
||||||
def pytest_configure(config):
|
def pytest_configure(config):
|
||||||
config.cache = Cache(config)
|
config.cache = Cache(config)
|
||||||
config.pluginmanager.register(StepwisePlugin(config), 'stepwiseplugin')
|
config.pluginmanager.register(StepwisePlugin(config), 'stepwiseplugin')
|
||||||
|
|
Loading…
Reference in New Issue