Skip to content

Commit

Permalink
vdk-core: adopt plugin 1.3
Browse files Browse the repository at this point in the history
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
  • Loading branch information
antoniivanov committed Aug 28, 2023
1 parent 47adb89 commit 02a0d30
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions projects/vdk-core/src/vdk/api/plugin/plugin_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,18 @@ class PluginException(Exception):
"""
Alias for the type of plugin hook call result returned in hookWrapper=True types of plugin hooks
"""
HookCallResult = (
pluggy.callers._Result if pluggy.__version__ < "1.0" else pluggy._callers._Result
)


def parse_version(version_str):
return tuple(map(int, version_str.split(".")))


if parse_version(pluggy.__version__) < parse_version("1.0"):
HookCallResult = pluggy.callers._Result
elif parse_version(pluggy.__version__) < parse_version("1.3"):
HookCallResult = pluggy._callers._Result
else: # since 1.3
HookCallResult = pluggy.Result


class IPluginRegistry(metaclass=ABCMeta):
Expand Down

0 comments on commit 02a0d30

Please sign in to comment.