Skip to content

Commit 51e6387

Browse files
nepetrustyrussell
authored andcommitted
test: refactor plugin to use parameter not envvar
Signed-off-by: Peter Neuroth <[email protected]>
1 parent 5932d3b commit 51e6387

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

tests/plugins/feature-test.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#!/usr/bin/env python3
22

33
from pyln.client import Plugin
4-
import os
54

65
# Register a different set feature of feature bits for each location so we can
76
# later check that they are being passed correctly.
@@ -15,10 +14,10 @@
1514

1615
@plugin.init()
1716
def init(configuration, options, plugin):
18-
disable = os.getenv("PLUGIN_DISABLE")
19-
if disable:
17+
if options.get('disable-on-init'):
2018
return {'disable': 'init saying disable'}
2119
return {}
2220

2321

22+
plugin.add_option('disable-on-init', False, 'disable plugin on init', opt_type='bool')
2423
plugin.run()

tests/test_plugin.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1748,7 +1748,7 @@ def test_plugin_feature_announce(node_factory):
17481748
assert node['features'] == expected_node_features(extra=[203])
17491749

17501750

1751-
def test_plugin_feature_remove(node_factory, monkeypatch):
1751+
def test_plugin_feature_remove(node_factory):
17521752
"""Check that features registered by plugins get removed if a plugin
17531753
disables itself.
17541754
@@ -1759,9 +1759,8 @@ def test_plugin_feature_remove(node_factory, monkeypatch):
17591759
- 1 << 205 for bolt11 invoices
17601760
"""
17611761

1762-
monkeypatch.setenv("PLUGIN_DISABLE", "1")
17631762
plugin = os.path.join(os.path.dirname(__file__), 'plugins/feature-test.py')
1764-
l1 = node_factory.get_node(options={'plugin': plugin})
1763+
l1 = node_factory.get_node(options={'plugin': plugin, 'disable-on-init': True})
17651764

17661765
# Check that we don't include the features set in getmanifest.
17671766
our_feats = l1.rpc.getinfo()["our_features"]

0 commit comments

Comments
 (0)