diff --git a/AUTHORS.rst b/AUTHORS.rst index 3b65134f..b1ca0a88 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -36,3 +36,4 @@ Authors * Albert Tugushev - https://github.com/atugushev * Martín Gaitán - https://github.com/mgaitan * Hugo van Kemenade - https://github.com/hugovk +* Michael Manganiello - https://github.com/adamantike diff --git a/CHANGELOG.rst b/CHANGELOG.rst index a679f7b7..95381fc6 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,12 @@ Changelog ========= +2.8.2 (unreleased) +------------------ + +* Fixed ``RemovedInPytest4Warning`` when using Pytest 3.10. + Contributed by Michael Manganiello in `#354 `_. + 2.8.1 (2019-10-05) ------------------ diff --git a/src/pytest_cov/plugin.py b/src/pytest_cov/plugin.py index fb7a8f54..1127e4c7 100644 --- a/src/pytest_cov/plugin.py +++ b/src/pytest_cov/plugin.py @@ -11,6 +11,8 @@ from . import embed from . import engine +PYTEST_VERSION = tuple(map(int, pytest.__version__.split('.')[:3])) + class CoverageError(Exception): """Indicates that our coverage is too low""" @@ -260,7 +262,7 @@ def pytest_runtestloop(self, session): message = 'Failed to generate report: %s\n' % exc session.config.pluginmanager.getplugin("terminalreporter").write( 'WARNING: %s\n' % message, red=True, bold=True) - if pytest.__version__ >= '3.8': + if PYTEST_VERSION >= (3, 8): warnings.warn(pytest.PytestWarning(message)) else: session.config.warn(code='COV-2', message=message) @@ -274,7 +276,7 @@ def pytest_terminal_summary(self, terminalreporter): if self._disabled: message = 'Coverage disabled via --no-cov switch!' terminalreporter.write('WARNING: %s\n' % message, red=True, bold=True) - if pytest.__version__ >= '3.8': + if PYTEST_VERSION >= (3, 8): warnings.warn(pytest.PytestWarning(message)) else: terminalreporter.config.warn(code='COV-1', message=message)