Skip to content

Commit 02a0d30

Browse files
committed
vdk-core: adopt plugin 1.3
Plugy realease of 1.3 on 25th of August introduced a changing renaming pluggy._callers._Result to pluggy.Result. It can be found in the list of changes between 1.2 and 1.3 : pytest-dev/pluggy@1.2.0...1.3.0 As we rely on that as a type for the Result object , it breaks vdk. This changing is adopting the pluggy change
1 parent 47adb89 commit 02a0d30

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

projects/vdk-core/src/vdk/api/plugin/plugin_registry.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,18 @@ class PluginException(Exception):
4343
"""
4444
Alias for the type of plugin hook call result returned in hookWrapper=True types of plugin hooks
4545
"""
46-
HookCallResult = (
47-
pluggy.callers._Result if pluggy.__version__ < "1.0" else pluggy._callers._Result
48-
)
46+
47+
48+
def parse_version(version_str):
49+
return tuple(map(int, version_str.split(".")))
50+
51+
52+
if parse_version(pluggy.__version__) < parse_version("1.0"):
53+
HookCallResult = pluggy.callers._Result
54+
elif parse_version(pluggy.__version__) < parse_version("1.3"):
55+
HookCallResult = pluggy._callers._Result
56+
else: # since 1.3
57+
HookCallResult = pluggy.Result
4958

5059

5160
class IPluginRegistry(metaclass=ABCMeta):

0 commit comments

Comments
 (0)