| commit 579: | 3a670dae9c16 |
| parent 578: | 36f51eda3860 |
| branch: | default |
Added section in plugin writing docs showing how to register a plugin without setuptools
11 months ago
Changed (Δ384 bytes):
raw changeset »
nose/plugins/__init__.py (20 lines added, 4 lines removed)
Up to file-list nose/plugins/__init__.py:
| … | … | @@ -24,16 +24,18 @@ Registering |
24 |
24 |
|
25 |
25 |
For nose to find a plugin, it must be part of a package that uses |
26 |
26 |
setuptools_, and the plugin must be included in the entry points defined |
27 |
in the setup.py for the package: |
|
27 |
in the setup.py for the package: |
|
28 |
28 |
|
29 |
setup(name='Some plugin', |
|
30 |
... |
|
29 |
.. code-block:: python |
|
30 |
||
31 |
setup(name='Some plugin', |
|
32 |
# ... |
|
31 |
33 |
entry_points = { |
32 |
34 |
'nose.plugins.0.10': [ |
33 |
35 |
'someplugin = someplugin:SomePlugin' |
34 |
36 |
] |
35 |
37 |
}, |
36 |
|
|
38 |
# ... |
|
37 |
39 |
) |
38 |
40 |
|
39 |
41 |
Once the package is installed with install or develop, nose will be able |
| … | … | @@ -41,6 +43,20 @@ to load the plugin. |
41 |
43 |
|
42 |
44 |
.. _setuptools: http://peak.telecommunity.com/DevCenter/setuptools |
43 |
45 |
|
46 |
Registering a plugin without setuptools |
|
47 |
======================================= |
|
48 |
||
49 |
It is currently possible to register a plugin programmatically by |
|
50 |
creating a custom nose runner like this : |
|
51 |
||
52 |
.. code-block:: python |
|
53 |
||
54 |
import nose |
|
55 |
from yourplugin import YourPlugin |
|
56 |
||
57 |
if __name__ == '__main__': |
|
58 |
nose.main(addplugins=[YourPlugin()]) |
|
59 |
||
44 |
60 |
Defining options |
45 |
61 |
================ |
46 |
62 |
