Skip to content

Commit

Permalink
Expect deprecation warnings throughout tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyler Goodlet committed May 22, 2018
1 parent 39f2136 commit 77578ad
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
11 changes: 7 additions & 4 deletions testing/test_method_ordering.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,8 @@ def he_method1(self):

@pytest.mark.parametrize('include_hookspec', [True, False])
def test_prefix_hookimpl(include_hookspec):
pm = PluginManager(hookspec.project_name, "hello_")
with pytest.deprecated_call():
pm = PluginManager(hookspec.project_name, "hello_")

if include_hookspec:
class HookSpec(object):
Expand All @@ -305,14 +306,16 @@ class Plugin(object):
def hello_myhook(self, arg1):
return arg1 + 1

pm.register(Plugin())
pm.register(Plugin())
with pytest.deprecated_call():
pm.register(Plugin())
pm.register(Plugin())
results = pm.hook.hello_myhook(arg1=17)
assert results == [18, 18]


def test_prefix_hookimpl_dontmatch_module():
pm = PluginManager(hookspec.project_name, "hello_")
with pytest.deprecated_call():
pm = PluginManager(hookspec.project_name, "hello_")

class BadPlugin(object):
hello_module = __import__('email')
Expand Down
8 changes: 5 additions & 3 deletions testing/test_pluginmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,12 +393,14 @@ def example_hook():
""")
exec(src, conftest.__dict__)
conftest.example_blah = types.ModuleType("example_blah")
name = pm.register(conftest)
with pytest.deprecated_call():
name = pm.register(conftest)
assert name == 'conftest'
assert getattr(pm.hook, 'example_blah', None) is None
assert getattr(pm.hook, 'example_hook', None) # conftest.example_hook should be collected
assert pm.parse_hookimpl_opts(conftest, 'example_blah') is None
assert pm.parse_hookimpl_opts(conftest, 'example_hook') == {}
with pytest.deprecated_call():
assert pm.parse_hookimpl_opts(conftest, 'example_blah') is None
assert pm.parse_hookimpl_opts(conftest, 'example_hook') == {}


def test_callhistoric_proc_deprecated(pm):
Expand Down

0 comments on commit 77578ad

Please sign in to comment.