From 5aafef14840bdffedb59083d1e287c36b22dd191 Mon Sep 17 00:00:00 2001 From: darosior Date: Thu, 2 Apr 2020 15:12:46 +0200 Subject: [PATCH] pytest: skip some test when DEPRECATED_APIS is enabled. --- tests/test_misc.py | 10 +++++++--- tests/test_plugin.py | 8 ++++++-- tests/utils.py | 2 +- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/tests/test_misc.py b/tests/test_misc.py index 8e034135e..37f3aaa1a 100644 --- a/tests/test_misc.py +++ b/tests/test_misc.py @@ -6,8 +6,8 @@ from flaky import flaky # noqa: F401 from pyln.client import RpcError from threading import Event from pyln.testing.utils import ( - DEVELOPER, TIMEOUT, VALGRIND, sync_blockheight, only_one, wait_for, - TailableProc, env + DEVELOPER, TIMEOUT, VALGRIND, DEPRECATED_APIS, sync_blockheight, only_one, + wait_for, TailableProc, env ) from ephemeral_port_reserve import reserve from utils import EXPERIMENTAL_FEATURES @@ -743,6 +743,7 @@ def test_address(node_factory): l2.rpc.connect(l1.info['id'], l1.daemon.opts['addr']) +@unittest.skipIf(DEPRECATED_APIS, "Tests the --allow-deprecated-apis config") def test_listconfigs(node_factory, bitcoind, chainparams): # Make extremely long entry, check it works l1 = node_factory.get_node(options={'log-prefix': 'lightning1-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'}) @@ -1352,7 +1353,10 @@ def test_ipv4_and_ipv6(node_factory): assert int(bind[0]['port']) == port -@unittest.skipIf(not DEVELOPER, "Without DEVELOPER=1 we snap to FEERATE_FLOOR on testnets") +@unittest.skipIf( + not DEVELOPER or DEPRECATED_APIS, "Without DEVELOPER=1 we snap to " + "FEERATE_FLOOR on testnets, and we test the new API." +) def test_feerates(node_factory): l1 = node_factory.get_node(options={'log-level': 'io'}, start=False) l1.daemon.rpcproxy.mock_rpc('estimatesmartfee', { diff --git a/tests/test_plugin.py b/tests/test_plugin.py index 2bb49d3bb..f1cbc2e06 100644 --- a/tests/test_plugin.py +++ b/tests/test_plugin.py @@ -5,7 +5,8 @@ from hashlib import sha256 from pyln.client import RpcError, Millisatoshi from pyln.proto import Invoice from utils import ( - DEVELOPER, only_one, sync_blockheight, TIMEOUT, wait_for, TEST_NETWORK, expected_features + DEVELOPER, only_one, sync_blockheight, TIMEOUT, wait_for, TEST_NETWORK, + DEPRECATED_APIS, expected_features ) import json @@ -46,6 +47,7 @@ def test_option_passthrough(node_factory, directory): n.stop() +@unittest.skipIf(DEPRECATED_APIS, "We test the new API.") def test_option_types(node_factory): """Ensure that desired types of options are respected in output """ @@ -914,7 +916,9 @@ def test_libplugin(node_factory): assert l1.rpc.call("testrpc") == l1.rpc.getinfo() -@unittest.skipIf(not DEVELOPER, "needs LIGHTNINGD_DEV_LOG_IO") +@unittest.skipIf( + not DEVELOPER or DEPRECATED_APIS, "needs LIGHTNINGD_DEV_LOG_IO and new API" +) def test_plugin_feature_announce(node_factory): """Check that features registered by plugins show up in messages. diff --git a/tests/utils.py b/tests/utils.py index 6be1abd58..a6a2aca38 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -1,4 +1,4 @@ -from pyln.testing.utils import TEST_NETWORK, SLOW_MACHINE, TIMEOUT, VALGRIND, DEVELOPER # noqa: F401 +from pyln.testing.utils import TEST_NETWORK, SLOW_MACHINE, TIMEOUT, VALGRIND, DEVELOPER, DEPRECATED_APIS # noqa: F401 from pyln.testing.utils import env, only_one, wait_for, write_config, TailableProc, sync_blockheight, wait_channel_quiescent, get_tx_p2wsh_outnum # noqa: F401