aboutsummaryrefslogtreecommitdiff
path: root/test/functional
diff options
context:
space:
mode:
authorSebastian Falbesoner <sebastian.falbesoner@gmail.com>2023-12-08 16:52:57 +0100
committerSebastian Falbesoner <sebastian.falbesoner@gmail.com>2023-12-08 18:15:34 +0100
commit37324ae3dfb0e50daaf752dc863a880559fa4637 (patch)
tree75ed44fbc492c3f9cd482de5ffa90567a7f21f95 /test/functional
parent3e691258d8789a4a89cce42e7e71b130491594d7 (diff)
test: use `skip_if_platform_not_linux` helper where possible
Rather than re-implementing these checks, we can use this test framework's helper (introduced in commit c934087b627f7d368458781944f990b0eb479634, PR #24358) called in a test's `skip_test_if_missing_module` method instead.
Diffstat (limited to 'test/functional')
-rwxr-xr-xtest/functional/feature_bind_extra.py10
-rwxr-xr-xtest/functional/rpc_bind.py11
2 files changed, 7 insertions, 14 deletions
diff --git a/test/functional/feature_bind_extra.py b/test/functional/feature_bind_extra.py
index 4a94d2ce7b..5cd031f852 100755
--- a/test/functional/feature_bind_extra.py
+++ b/test/functional/feature_bind_extra.py
@@ -7,15 +7,12 @@ Test starting bitcoind with -bind and/or -bind=...=onion and confirm
that bind happens on the expected ports.
"""
-import sys
-
from test_framework.netutil import (
addr_to_hex,
get_bind_addrs,
)
from test_framework.test_framework import (
BitcoinTestFramework,
- SkipTest,
)
from test_framework.util import (
assert_equal,
@@ -32,12 +29,11 @@ class BindExtraTest(BitcoinTestFramework):
self.bind_to_localhost_only = False
self.num_nodes = 2
- def setup_network(self):
+ def skip_test_if_missing_module(self):
# Due to OS-specific network stats queries, we only run on Linux.
- self.log.info("Checking for Linux")
- if not sys.platform.startswith('linux'):
- raise SkipTest("This test can only be run on Linux.")
+ self.skip_if_platform_not_linux()
+ def setup_network(self):
loopback_ipv4 = addr_to_hex("127.0.0.1")
# Start custom ports by reusing unused p2p ports
diff --git a/test/functional/rpc_bind.py b/test/functional/rpc_bind.py
index 43cd23fc7a..3106419e5c 100755
--- a/test/functional/rpc_bind.py
+++ b/test/functional/rpc_bind.py
@@ -4,8 +4,6 @@
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test running bitcoind with the -rpcbind and -rpcallowip options."""
-import sys
-
from test_framework.netutil import all_interfaces, addr_to_hex, get_bind_addrs, test_ipv6_local
from test_framework.test_framework import BitcoinTestFramework, SkipTest
from test_framework.util import assert_equal, assert_raises_rpc_error, get_rpc_proxy, rpc_port, rpc_url
@@ -17,6 +15,10 @@ class RPCBindTest(BitcoinTestFramework):
self.num_nodes = 1
self.supports_cli = False
+ def skip_test_if_missing_module(self):
+ # due to OS-specific network stats queries, this test works only on Linux
+ self.skip_if_platform_not_linux()
+
def setup_network(self):
self.add_nodes(self.num_nodes, None)
@@ -61,14 +63,9 @@ class RPCBindTest(BitcoinTestFramework):
self.stop_nodes()
def run_test(self):
- # due to OS-specific network stats queries, this test works only on Linux
if sum([self.options.run_ipv4, self.options.run_ipv6, self.options.run_nonloopback]) > 1:
raise AssertionError("Only one of --ipv4, --ipv6 and --nonloopback can be set")
- self.log.info("Check for linux")
- if not sys.platform.startswith('linux'):
- raise SkipTest("This test can only be run on linux.")
-
self.log.info("Check for ipv6")
have_ipv6 = test_ipv6_local()
if not have_ipv6 and not (self.options.run_ipv4 or self.options.run_nonloopback):