File tree Expand file tree Collapse file tree 4 files changed +54
-46
lines changed Expand file tree Collapse file tree 4 files changed +54
-46
lines changed Original file line number Diff line number Diff line change
1
+ """
2
+ Deprecation warnings testing roundup.
3
+ """
4
+ import pytest
5
+ from pluggy .callers import _Result
6
+ from pluggy import PluginManager , HookimplMarker , HookspecMarker
7
+
8
+ hookspec = HookspecMarker ("example" )
9
+ hookimpl = HookimplMarker ("example" )
10
+
11
+
12
+ def test_result_deprecated ():
13
+ r = _Result (10 , None )
14
+ with pytest .deprecated_call ():
15
+ assert r .result == 10
16
+
17
+
18
+ def test_implprefix_deprecated ():
19
+ with pytest .deprecated_call ():
20
+ pm = PluginManager ('blah' , implprefix = 'blah_' )
21
+
22
+ class Plugin :
23
+ def blah_myhook (self , arg1 ):
24
+ return arg1
25
+
26
+ with pytest .deprecated_call ():
27
+ pm .register (Plugin ())
28
+
29
+
30
+ def test_callhistoric_proc_deprecated (pm ):
31
+ """``proc`` kwarg to `PluginMananger.call_historic()` is now officially
32
+ deprecated.
33
+ """
34
+ class P1 (object ):
35
+ @hookspec (historic = True )
36
+ @hookimpl
37
+ def m (self , x ):
38
+ pass
39
+
40
+ p1 = P1 ()
41
+ pm .add_hookspecs (p1 )
42
+ pm .register (p1 )
43
+ with pytest .deprecated_call ():
44
+ pm .hook .m .call_historic (kwargs = dict (x = 10 ), proc = lambda res : res )
45
+
46
+
47
+ def test_multicall_deprecated (pm ):
48
+ class P1 (object ):
49
+ @hookimpl
50
+ def m (self , __multicall__ , x ):
51
+ pass
52
+
53
+ pytest .deprecated_call (pm .register , P1 ())
Original file line number Diff line number Diff line change 1
1
import warnings
2
2
import pytest
3
3
from pluggy import PluginManager , HookimplMarker , HookspecMarker
4
- from pluggy .callers import _Result
5
4
6
5
hookspec = HookspecMarker ("example" )
7
6
hookimpl = HookimplMarker ("example" )
@@ -118,21 +117,3 @@ def myhook(self, arg1):
118
117
warning = warns [- 1 ]
119
118
assert issubclass (warning .category , Warning )
120
119
assert "Argument(s) ('arg2',)" in str (warning .message )
121
-
122
-
123
- def test_result_deprecated ():
124
- r = _Result (10 , None )
125
- with pytest .deprecated_call ():
126
- assert r .result == 10
127
-
128
-
129
- def test_implprefix_deprecated ():
130
- with pytest .deprecated_call ():
131
- pm = PluginManager ('blah' , implprefix = 'blah_' )
132
-
133
- class Plugin :
134
- def blah_myhook (self , arg1 ):
135
- return arg1
136
-
137
- with pytest .deprecated_call ():
138
- pm .register (Plugin ())
Original file line number Diff line number Diff line change @@ -179,7 +179,7 @@ def he_myhook1(arg1):
179
179
assert not hasattr (he_myhook1 , name )
180
180
181
181
182
- def test_happypath (pm ):
182
+ def test_hookrelay_registry (pm ):
183
183
"""Verify hook caller instances are registered by name onto the relay
184
184
and can be likewise unregistered."""
185
185
class Api (object ):
Original file line number Diff line number Diff line change @@ -374,15 +374,6 @@ class PluginNo(object):
374
374
assert out == [10 ]
375
375
376
376
377
- def test_multicall_deprecated (pm ):
378
- class P1 (object ):
379
- @hookimpl
380
- def m (self , __multicall__ , x ):
381
- pass
382
-
383
- pytest .deprecated_call (pm .register , P1 ())
384
-
385
-
386
377
def test_add_hookspecs_nohooks (pm ):
387
378
with pytest .raises (ValueError ):
388
379
pm .add_hookspecs (10 )
@@ -411,23 +402,6 @@ def example_hook():
411
402
assert pm .parse_hookimpl_opts (conftest , 'example_hook' ) == {}
412
403
413
404
414
- def test_callhistoric_proc_deprecated (pm ):
415
- """``proc`` kwarg to `PluginMananger.call_historic()` is now officially
416
- deprecated.
417
- """
418
- class P1 (object ):
419
- @hookspec (historic = True )
420
- @hookimpl
421
- def m (self , x ):
422
- pass
423
-
424
- p1 = P1 ()
425
- pm .add_hookspecs (p1 )
426
- pm .register (p1 )
427
- with pytest .deprecated_call ():
428
- pm .hook .m .call_historic (kwargs = dict (x = 10 ), proc = lambda res : res )
429
-
430
-
431
405
def test_load_setuptools_instantiation (monkeypatch , pm ):
432
406
pkg_resources = pytest .importorskip ("pkg_resources" )
433
407
You can’t perform that action at this time.
0 commit comments