forked from pytest-dev/pluggy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request pytest-dev#153 from tgoodlet/tests_reorg
Tests reorg
- Loading branch information
Showing
5 changed files
with
228 additions
and
210 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
""" | ||
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()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.