diff options
author | Devtools Arcadia <arcadia-devtools@yandex-team.ru> | 2022-02-07 18:08:42 +0300 |
---|---|---|
committer | Devtools Arcadia <arcadia-devtools@mous.vla.yp-c.yandex.net> | 2022-02-07 18:08:42 +0300 |
commit | 1110808a9d39d4b808aef724c861a2e1a38d2a69 (patch) | |
tree | e26c9fed0de5d9873cce7e00bc214573dc2195b7 /contrib/python/pluggy/py2/tests/test_deprecations.py | |
download | ydb-1110808a9d39d4b808aef724c861a2e1a38d2a69.tar.gz |
intermediate changes
ref:cde9a383711a11544ce7e107a78147fb96cc4029
Diffstat (limited to 'contrib/python/pluggy/py2/tests/test_deprecations.py')
-rw-r--r-- | contrib/python/pluggy/py2/tests/test_deprecations.py | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/contrib/python/pluggy/py2/tests/test_deprecations.py b/contrib/python/pluggy/py2/tests/test_deprecations.py new file mode 100644 index 0000000000..7151921b66 --- /dev/null +++ b/contrib/python/pluggy/py2/tests/test_deprecations.py @@ -0,0 +1,54 @@ +""" +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_") + + class Plugin: + def blah_myhook(self, arg1): + return arg1 + + with pytest.deprecated_call(): + pm.register(Plugin()) + + +def test_callhistoric_proc_deprecated(pm): + """``proc`` kwarg to `PluginMananger.call_historic()` is now officially + deprecated. + """ + + class P1(object): + @hookspec(historic=True) + @hookimpl + def m(self, x): + pass + + p1 = P1() + pm.add_hookspecs(p1) + pm.register(p1) + with pytest.deprecated_call(): + pm.hook.m.call_historic(kwargs=dict(x=10), proc=lambda res: res) + + +def test_multicall_deprecated(pm): + class P1(object): + @hookimpl + def m(self, __multicall__, x): + pass + + pytest.deprecated_call(pm.register, P1()) |