From de2669fae04ba83b5206620e2a6518df145af7d0 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Thu, 4 Jun 2020 18:59:27 +0300 Subject: [PATCH] Remove deprecated _Result.result --- changelog/265.removal.rst | 3 +++ src/pluggy/_result.py | 7 ------- testing/test_deprecations.py | 7 ------- 3 files changed, 3 insertions(+), 14 deletions(-) create mode 100644 changelog/265.removal.rst diff --git a/changelog/265.removal.rst b/changelog/265.removal.rst new file mode 100644 index 00000000..1b882a30 --- /dev/null +++ b/changelog/265.removal.rst @@ -0,0 +1,3 @@ +Remove the ``_Result.result`` property. Use ``_Result.get_result()`` instead. +Note that unlike ``result``, ``get_result()`` raises the exception if the hook raised. +The deprecation was announced in release ``0.6.0``. diff --git a/src/pluggy/_result.py b/src/pluggy/_result.py index 54538f35..97038363 100644 --- a/src/pluggy/_result.py +++ b/src/pluggy/_result.py @@ -37,13 +37,6 @@ def __init__(self, result, excinfo): def excinfo(self): return self._excinfo - @property - def result(self): - """Get the result(s) for this hook call (DEPRECATED in favor of ``get_result()``).""" - msg = "Use get_result() which forces correct exception handling" - warnings.warn(DeprecationWarning(msg), stacklevel=2) - return self._result - @classmethod def from_call(cls, func): __tracebackhide__ = True diff --git a/testing/test_deprecations.py b/testing/test_deprecations.py index 28bc930f..bfec882f 100644 --- a/testing/test_deprecations.py +++ b/testing/test_deprecations.py @@ -2,19 +2,12 @@ Deprecation warnings testing roundup. """ import pytest -from pluggy.callers import _Result from pluggy import PluginManager, HookimplMarker, HookspecMarker hookspec = HookspecMarker("example") hookimpl = HookimplMarker("example") -def test_result_deprecated(): - r = _Result(10, None) - with pytest.deprecated_call(): - assert r.result == 10 - - def test_implprefix_deprecated(): with pytest.deprecated_call(): pm = PluginManager("blah", implprefix="blah_")