Skip to content

Commit a05a374

Browse files
whitslackrustyrussell
authored andcommitted
tests: skip certain tests if RUST is not enabled
* tests/test_cln_lsps.py::test_lsps0_listprotocols * tests/test_clnrest.py * tests/test_connection.py::test_wss_proxy Changelog-Fixed: pytest: Tests that require Rust no longer fail if Rust is disabled.
1 parent 084b033 commit a05a374

File tree

5 files changed

+16
-4
lines changed

5 files changed

+16
-4
lines changed

contrib/pyln-testing/pyln/testing/utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ def env(name, default=None):
8383
EXPERIMENTAL_DUAL_FUND = env("EXPERIMENTAL_DUAL_FUND", "0") == "1"
8484
EXPERIMENTAL_SPLICING = env("EXPERIMENTAL_SPLICING", "0") == "1"
8585
GENERATE_EXAMPLES = env("GENERATE_EXAMPLES", "0") == "1"
86+
RUST = env("RUST", "0") == "1"
8687

8788

8889
def wait_for(success, timeout=TIMEOUT):

tests/test_cln_lsps.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
from fixtures import * # noqa: F401,F403
2+
from pyln.testing.utils import RUST
3+
24
import os
5+
import unittest
36

47
RUST_PROFILE = os.environ.get("RUST_PROFILE", "debug")
58

@@ -15,6 +18,7 @@ def test_lsps_service_disabled(node_factory):
1518
l1.daemon.is_in_log("`lsps-service` not enabled")
1619

1720

21+
@unittest.skipUnless(RUST, 'RUST is not enabled')
1822
def test_lsps0_listprotocols(node_factory):
1923
l1, l2 = node_factory.get_nodes(2, opts=[
2024
{}, {"dev-lsps-service": True}

tests/test_cln_rs.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from fixtures import * # noqa: F401,F403
22
from pathlib import Path
33
from pyln import grpc as clnpb
4-
from pyln.testing.utils import env, TEST_NETWORK, wait_for, sync_blockheight, TIMEOUT, RpcError
4+
from pyln.testing.utils import RUST, TEST_NETWORK, wait_for, sync_blockheight, TIMEOUT, RpcError
55
from utils import first_scid
66
import grpc
77
import pytest
@@ -11,7 +11,7 @@
1111

1212
# Skip the entire module if we don't have Rust.
1313
pytestmark = pytest.mark.skipif(
14-
env('RUST') != '1',
14+
not RUST,
1515
reason='RUST is not enabled skipping rust-dependent tests'
1616
)
1717

tests/test_clnrest.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from fixtures import * # noqa: F401,F403
2-
from pyln.testing.utils import TEST_NETWORK, wait_for
2+
from pyln.testing.utils import RUST, TEST_NETWORK, wait_for
33
from pyln.client import Millisatoshi
44
import requests
55
from pathlib import Path
@@ -10,6 +10,12 @@
1010
import pytest
1111
import json
1212

13+
# Skip the entire module if we don't have Rust.
14+
pytestmark = pytest.mark.skipif(
15+
not RUST,
16+
reason='RUST is not enabled; skipping Rust-dependent tests'
17+
)
18+
1319

1420
def http_session_with_retry():
1521
# All requests are done after matching "REST server running" in the log,

tests/test_connection.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
mine_funding_to_announce, first_scid,
1414
CHANNEL_SIZE
1515
)
16-
from pyln.testing.utils import SLOW_MACHINE, VALGRIND, EXPERIMENTAL_DUAL_FUND, FUNDAMOUNT
16+
from pyln.testing.utils import SLOW_MACHINE, VALGRIND, EXPERIMENTAL_DUAL_FUND, FUNDAMOUNT, RUST
1717

1818
import os
1919
import pytest
@@ -4565,6 +4565,7 @@ def test_last_stable_connection(node_factory):
45654565
assert only_one(l2.rpc.listpeerchannels()['channels'])['last_stable_connection'] >= recon_time + STABLE_TIME
45664566

45674567

4568+
@unittest.skipUnless(RUST, 'RUST is not enabled')
45684569
def test_wss_proxy(node_factory):
45694570
wss_port = node_factory.get_unused_port()
45704571
ws_port = node_factory.get_unused_port()

0 commit comments

Comments
 (0)