pytest: fix if no rust installed.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2022-04-01 14:42:45 +10:30
parent bba68e2136
commit 3feb634d31
1 changed files with 8 additions and 2 deletions

View File

@ -1,10 +1,8 @@
from fixtures import * # noqa: F401,F403 from fixtures import * # noqa: F401,F403
from node_pb2_grpc import NodeStub
from pathlib import Path from pathlib import Path
from pyln.testing.utils import env, TEST_NETWORK, wait_for from pyln.testing.utils import env, TEST_NETWORK, wait_for
from ephemeral_port_reserve import reserve from ephemeral_port_reserve import reserve
import grpc import grpc
import node_pb2 as nodepb
from primitives_pb2 import AmountOrAny from primitives_pb2 import AmountOrAny
import pytest import pytest
import subprocess import subprocess
@ -74,6 +72,10 @@ def test_plugin_start(node_factory):
def test_grpc_connect(node_factory): def test_grpc_connect(node_factory):
"""Attempts to connect to the grpc interface and call getinfo""" """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() grpc_port = reserve()
bin_path = Path.cwd() / "target" / "debug" / "cln-grpc" bin_path = Path.cwd() / "target" / "debug" / "cln-grpc"
l1 = node_factory.get_node(options={"plugin": str(bin_path), "grpc-port": str(grpc_port)}) 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, We create two instances, each generates its own certs and keys,
and then we try to cross the wires. 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() grpc_port = reserve()
bin_path = Path.cwd() / "target" / "debug" / "cln-grpc" bin_path = Path.cwd() / "target" / "debug" / "cln-grpc"
l1, l2 = node_factory.get_nodes(2, opts={ l1, l2 = node_factory.get_nodes(2, opts={