Skip to content

Commit 7b2fb4c

Browse files
committed
Test plugin auto-discovery
1 parent 893751a commit 7b2fb4c

File tree

6 files changed

+22
-0
lines changed

6 files changed

+22
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
def test_plugin_discovery():
2+
from trinity_test_plugin import TestPlugin
3+
from trinity.plugins.registry import ALL_PLUGINS
4+
assert any(isinstance(plugin, TestPlugin) for plugin in ALL_PLUGINS)

tests/trinity/integration/trinity_test_plugin/__init__.py

Whitespace-only changes.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
from setuptools import setup
4+
5+
setup(
6+
name='trinity_test_plugin',
7+
py_modules=['trinity_test_plugin'],
8+
entry_points={'trinity.plugins': 'trinity_test_plugin=trinity_test_plugin:TestPlugin'},
9+
)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from trinity.extensibility.plugin import BaseIsolatedPlugin
2+
3+
4+
class TestPlugin(BaseIsolatedPlugin):
5+
6+
@property
7+
def name(self) -> str:
8+
return "TestPlugin"

tox.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ commands=
6666

6767
[common-trinity-integration]
6868
deps = .[p2p,trinity,eth-extra,test]
69+
{toxinidir}/tests/trinity/integration/trinity_test_plugin/dist/trinity_test_plugin-0.0.0.tar.gz
6970
passenv =
7071
PYTEST_ADDOPTS
7172
TRAVIS_EVENT_TYPE

0 commit comments

Comments
 (0)