Skip to content

Commit 2a2c971

Browse files
committed
Add test for PluginValidationError.plugin
1 parent 6486ee8 commit 2a2c971

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

testing/test_pluginmanager.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,12 @@ class hello(object):
103103
def he_method_notexists(self):
104104
pass
105105

106-
he_pm.register(hello())
107-
with pytest.raises(PluginValidationError):
106+
plugin = hello()
107+
108+
he_pm.register(plugin)
109+
with pytest.raises(PluginValidationError) as excinfo:
108110
he_pm.check_pending()
111+
assert excinfo.value.plugin is plugin
109112

110113

111114
def test_register_mismatch_arg(he_pm):
@@ -114,8 +117,11 @@ class hello(object):
114117
def he_method1(self, qlwkje):
115118
pass
116119

117-
with pytest.raises(PluginValidationError):
118-
he_pm.register(hello())
120+
plugin = hello()
121+
122+
with pytest.raises(PluginValidationError) as excinfo:
123+
he_pm.register(plugin)
124+
assert excinfo.value.plugin is plugin
119125

120126

121127
def test_register(pm):

0 commit comments

Comments
 (0)