Skip to content

Commit f9e938c

Browse files
committed
test: refactor plugin to use parameter not envvar
Signed-off-by: Peter Neuroth <[email protected]>
1 parent 32ab8fc commit f9e938c

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

tests/plugins/feature-test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515

1616
@plugin.init()
1717
def init(configuration, options, plugin):
18-
disable = os.getenv("PLUGIN_DISABLE")
19-
if disable:
18+
if options.get('disable-on-init'):
2019
return {'disable': 'init saying disable'}
2120
return {}
2221

2322

23+
plugin.add_option('disable-on-init', False, 'disable plugin on init', opt_type='bool')
2424
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)