pytest 2.7 compatibility.

This commit is contained in:
Niclas Olofsson 2015-09-26 15:23:11 +02:00 committed by David Szotten
parent 33f1ff4e8c
commit bd9495486b
2 changed files with 10 additions and 3 deletions

View File

@ -1,4 +1,12 @@
import pytest
try:
from _pytest.cacheprovider import Cache
except ImportError:
from pytest_cache import Cache
if hasattr(pytest, 'hookimpl'):
tryfirst = pytest.hookimpl(tryfirst=True)
else:
tryfirst = pytest.mark.tryfirst

View File

@ -1,5 +1,4 @@
import pytest
from .compat import Cache
from .compat import Cache, tryfirst
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')
@pytest.hookimpl(tryfirst=True)
@tryfirst
def pytest_configure(config):
config.cache = Cache(config)
config.pluginmanager.register(StepwisePlugin(config), 'stepwiseplugin')