Skip to content

Commit 7fe9ec8

Browse files
committed
change naming of decorators and refine their docstrings.
1 parent 091de53 commit 7fe9ec8

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

pluggy.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,17 @@
6969

7070
__version__ = '0.2.0'
7171
__all__ = ["PluginManager", "PluginValidationError",
72-
"HookspecDecorator", "HookimplDecorator"]
72+
"HookspecMarker", "HookimplMarker"]
7373

7474
_py3 = sys.version_info > (3, 0)
7575

7676

77-
class HookspecDecorator:
77+
class HookspecMarker:
7878
""" Decorator helper class for marking functions as hook specifications.
7979
80-
You can instantiate it to get a decorator.
81-
80+
You can instantiate it with a project_name to get a decorator.
81+
Calling PluginManager.add_hookspecs later will discover all marked functions
82+
if the PluginManager uses the same project_name.
8283
"""
8384

8485
def __init__(self, project_name):
@@ -111,10 +112,12 @@ def setattr_hookspec_opts(func):
111112
return setattr_hookspec_opts
112113

113114

114-
class HookimplDecorator:
115+
class HookimplMarker:
115116
""" Decorator helper class for marking functions as hook implementations.
116117
117-
You can instantiate it to get a decorator.
118+
You can instantiate with a project_name to get a decorator.
119+
Calling PluginManager.register later will discover all marked functions
120+
if the PluginManager uses the same project_name.
118121
119122
"""
120123
def __init__(self, project_name):

test_pluggy.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
import pytest
55

66
from pluggy import (PluginManager, varnames, PluginValidationError,
7-
HookimplDecorator, HookspecDecorator)
7+
HookimplMarker, HookspecMarker)
88

99
from pluggy import (_MultiCall, _TagTracer, _HookImpl)
1010

11-
hookspec = HookspecDecorator("example")
12-
hookimpl = HookimplDecorator("example")
11+
hookspec = HookspecMarker("example")
12+
hookimpl = HookimplMarker("example")
1313

1414

1515
@pytest.fixture

0 commit comments

Comments
 (0)