diff --git a/tests/plugins/feature-test.py b/tests/plugins/feature-test.py index 459002167..37f27fc2c 100755 --- a/tests/plugins/feature-test.py +++ b/tests/plugins/feature-test.py @@ -1,7 +1,6 @@ #!/usr/bin/env python3 from pyln.client import Plugin -import os # Register a different set feature of feature bits for each location so we can # later check that they are being passed correctly. @@ -15,10 +14,10 @@ plugin = Plugin( @plugin.init() def init(configuration, options, plugin): - disable = os.getenv("PLUGIN_DISABLE") - if disable: + if options.get('disable-on-init'): return {'disable': 'init saying disable'} return {} +plugin.add_option('disable-on-init', False, 'disable plugin on init', opt_type='bool') plugin.run() diff --git a/tests/test_plugin.py b/tests/test_plugin.py index fa9137e91..a9345140e 100644 --- a/tests/test_plugin.py +++ b/tests/test_plugin.py @@ -1748,7 +1748,7 @@ def test_plugin_feature_announce(node_factory): assert node['features'] == expected_node_features(extra=[203]) -def test_plugin_feature_remove(node_factory, monkeypatch): +def test_plugin_feature_remove(node_factory): """Check that features registered by plugins get removed if a plugin disables itself. @@ -1759,9 +1759,8 @@ def test_plugin_feature_remove(node_factory, monkeypatch): - 1 << 205 for bolt11 invoices """ - monkeypatch.setenv("PLUGIN_DISABLE", "1") plugin = os.path.join(os.path.dirname(__file__), 'plugins/feature-test.py') - l1 = node_factory.get_node(options={'plugin': plugin}) + l1 = node_factory.get_node(options={'plugin': plugin, 'disable-on-init': True}) # Check that we don't include the features set in getmanifest. our_feats = l1.rpc.getinfo()["our_features"]