From 3feb634d31e0e9c6c740b918be56479bd55a9641 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Fri, 1 Apr 2022 14:42:45 +1030 Subject: [PATCH] pytest: fix if no rust installed. Signed-off-by: Rusty Russell --- tests/test_cln_rs.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/test_cln_rs.py b/tests/test_cln_rs.py index 140ffa392..1bffc70dd 100644 --- a/tests/test_cln_rs.py +++ b/tests/test_cln_rs.py @@ -1,10 +1,8 @@ from fixtures import * # noqa: F401,F403 -from node_pb2_grpc import NodeStub from pathlib import Path from pyln.testing.utils import env, TEST_NETWORK, wait_for from ephemeral_port_reserve import reserve import grpc -import node_pb2 as nodepb from primitives_pb2 import AmountOrAny import pytest import subprocess @@ -74,6 +72,10 @@ def test_plugin_start(node_factory): def test_grpc_connect(node_factory): """Attempts to connect to the grpc interface and call getinfo""" + # These only exist if we have rust! + from node_pb2_grpc import NodeStub # noqa: E402 + import node_pb2 as nodepb # noqa: E402 + grpc_port = reserve() bin_path = Path.cwd() / "target" / "debug" / "cln-grpc" l1 = node_factory.get_node(options={"plugin": str(bin_path), "grpc-port": str(grpc_port)}) @@ -172,6 +174,10 @@ def test_grpc_wrong_auth(node_factory): We create two instances, each generates its own certs and keys, and then we try to cross the wires. """ + # These only exist if we have rust! + from node_pb2_grpc import NodeStub # noqa: E402 + import node_pb2 as nodepb # noqa: E402 + grpc_port = reserve() bin_path = Path.cwd() / "target" / "debug" / "cln-grpc" l1, l2 = node_factory.get_nodes(2, opts={