ansible-later/env_27/lib/python2.7/site-packages/pytest_cov/compat.py
Robert Kaussow 10aaa8e7e3 fix pytest
2019-04-11 15:56:20 +02:00

32 lines
716 B
Python

try:
from StringIO import StringIO
except ImportError:
from io import StringIO
import pytest
StringIO # pyflakes, this is for re-export
if hasattr(pytest, 'hookimpl'):
hookwrapper = pytest.hookimpl(hookwrapper=True)
else:
hookwrapper = pytest.mark.hookwrapper
class SessionWrapper(object):
def __init__(self, session):
self._session = session
if hasattr(session, 'testsfailed'):
self._attr = 'testsfailed'
else:
self._attr = '_testsfailed'
@property
def testsfailed(self):
return getattr(self._session, self._attr)
@testsfailed.setter
def testsfailed(self, value):
setattr(self._session, self._attr, value)