File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,44 @@ def hello(self, arg):
64
64
assert comprehensible in str (exc .value )
65
65
66
66
67
+ def test_call_order (pm ):
68
+ class Api (object ):
69
+ @hookspec
70
+ def hello (self , arg ):
71
+ "api hook 1"
72
+
73
+ pm .add_hookspecs (Api )
74
+
75
+ class Plugin1 (object ):
76
+ @hookimpl
77
+ def hello (self , arg ):
78
+ return 1
79
+
80
+ class Plugin2 (object ):
81
+ @hookimpl
82
+ def hello (self , arg ):
83
+ return 2
84
+
85
+ class Plugin3 (object ):
86
+ @hookimpl
87
+ def hello (self , arg ):
88
+ return 3
89
+
90
+ class Plugin4 (object ):
91
+ @hookimpl (hookwrapper = True )
92
+ def hello (self , arg ):
93
+ assert arg == 0
94
+ outcome = yield
95
+ assert outcome .get_result () == [3 , 2 , 1 ]
96
+
97
+ pm .register (Plugin1 ())
98
+ pm .register (Plugin2 ())
99
+ pm .register (Plugin3 ())
100
+ pm .register (Plugin4 ()) # hookwrapper should get same list result
101
+ res = pm .hook .hello (arg = 0 )
102
+ assert res == [3 , 2 , 1 ]
103
+
104
+
67
105
def test_firstresult_definition (pm ):
68
106
class Api (object ):
69
107
@hookspec (firstresult = True )
You can’t perform that action at this time.
0 commit comments