tests: skip certain tests if RUST is not enabled
What changed, and why it matters
This commit only changes test code. It makes pytest skip certain tests when the software is built without Rust support, so those tests no longer fail in non-Rust builds. There is no change to the actual Lightning node or wallet code, and no security issue is introduced or fixed.
No security action needed; this is a routine test-suite fix.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch adds a RUST environment-variable flag to pyln/testing/utils.py and uses it to skip Rust-dependent tests in test_cln_lsps.py, test_cln_rs.py, test_clnrest.py, and test_connection.py when RUST is not enabled. It is a testing-infrastructure fix with no runtime code changes.
Changed components
contrib/pyln-testing/pyln/testing/utils.pytests/test_cln_lsps.pytests/test_cln_rs.pytests/test_clnrest.pytests/test_connection.pyInspect captured patch +16 / −4
diff --git a/contrib/pyln-testing/pyln/testing/utils.py b/contrib/pyln-testing/pyln/testing/utils.py
index 0c931670..c9b02ac6 100644
--- a/contrib/pyln-testing/pyln/testing/utils.py
+++ b/contrib/pyln-testing/pyln/testing/utils.py
@@ -83,6 +83,7 @@ TIMEOUT = int(env("TIMEOUT", 180 if SLOW_MACHINE else 60))
EXPERIMENTAL_DUAL_FUND = env("EXPERIMENTAL_DUAL_FUND", "0") == "1"
EXPERIMENTAL_SPLICING = env("EXPERIMENTAL_SPLICING", "0") == "1"
GENERATE_EXAMPLES = env("GENERATE_EXAMPLES", "0") == "1"
+RUST = env("RUST", "0") == "1"
def wait_for(success, timeout=TIMEOUT):
diff --git a/tests/test_cln_lsps.py b/tests/test_cln_lsps.py
index 68ae1379..28f09d64 100644
--- a/tests/test_cln_lsps.py
+++ b/tests/test_cln_lsps.py
@@ -1,5 +1,8 @@
from fixtures import * # noqa: F401,F403
+from pyln.testing.utils import RUST
+
import os
+import unittest
RUST_PROFILE = os.environ.get("RUST_PROFILE", "debug")
@@ -15,6 +18,7 @@ def test_lsps_service_disabled(node_factory):
l1.daemon.is_in_log("`lsps-service` not enabled")
+@unittest.skipUnless(RUST, 'RUST is not enabled')
def test_lsps0_listprotocols(node_factory):
l1, l2 = node_factory.get_nodes(2, opts=[
{}, {"dev-lsps-service": True}
diff --git a/tests/test_cln_rs.py b/tests/test_cln_rs.py
index fe474575..7ddc5047 100644
--- a/tests/test_cln_rs.py
+++ b/tests/test_cln_rs.py
@@ -1,7 +1,7 @@
from fixtures import * # noqa: F401,F403
from pathlib import Path
from pyln import grpc as clnpb
-from pyln.testing.utils import env, TEST_NETWORK, wait_for, sync_blockheight, TIMEOUT, RpcError
+from pyln.testing.utils import RUST, TEST_NETWORK, wait_for, sync_blockheight, TIMEOUT, RpcError
from utils import first_scid
import grpc
import pytest
@@ -11,7 +11,7 @@ import re
# Skip the entire module if we don't have Rust.
pytestmark = pytest.mark.skipif(
- env('RUST') != '1',
+ not RUST,
reason='RUST is not enabled skipping rust-dependent tests'
)
diff --git a/tests/test_clnrest.py b/tests/test_clnrest.py
index 47206c04..a24f0ac1 100644
--- a/tests/test_clnrest.py
+++ b/tests/test_clnrest.py
@@ -1,5 +1,5 @@
from fixtures import * # noqa: F401,F403
-from pyln.testing.utils import TEST_NETWORK, wait_for
+from pyln.testing.utils import RUST, TEST_NETWORK, wait_for
from pyln.client import Millisatoshi
import requests
from pathlib import Path
@@ -10,6 +10,12 @@ import time
import pytest
import json
+# Skip the entire module if we don't have Rust.
+pytestmark = pytest.mark.skipif(
+ not RUST,
+ reason='RUST is not enabled; skipping Rust-dependent tests'
+)
+
def http_session_with_retry():
# All requests are done after matching "REST server running" in the log,
diff --git a/tests/test_connection.py b/tests/test_connection.py
index e3701acf..ae0473b2 100644
--- a/tests/test_connection.py
+++ b/tests/test_connection.py
@@ -13,7 +13,7 @@ from utils import (
mine_funding_to_announce, first_scid,
CHANNEL_SIZE
)
-from pyln.testing.utils import SLOW_MACHINE, VALGRIND, EXPERIMENTAL_DUAL_FUND, FUNDAMOUNT
+from pyln.testing.utils import SLOW_MACHINE, VALGRIND, EXPERIMENTAL_DUAL_FUND, FUNDAMOUNT, RUST
import os
import pytest
@@ -4565,6 +4565,7 @@ def test_last_stable_connection(node_factory):
assert only_one(l2.rpc.listpeerchannels()['channels'])['last_stable_connection'] >= recon_time + STABLE_TIME
+@unittest.skipUnless(RUST, 'RUST is not enabled')
def test_wss_proxy(node_factory):
wss_port = node_factory.get_unused_port()
ws_port = node_factory.get_unused_port()
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.