From 6034be4be4a994c206e28e8f70c6a46656cc49b6 Mon Sep 17 00:00:00 2001 From: Stefan Verhoeven Date: Mon, 26 Jun 2023 10:30:24 +0200 Subject: [PATCH 1/2] Test against apptainer 1.1.9 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0305d88..52be444 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,7 +26,7 @@ jobs: - name: Setup Apptainer uses: eWaterCycle/setup-apptainer@v2 with: - apptainer-version: 1.1.3 + apptainer-version: 1.1.9 - name: Pull Docker image run: docker pull ewatercycle/walrus-grpc4bmi:v0.3.1 - name: Cache Apptainer image From d96b5a23051382564d610db65342358842ea332b Mon Sep 17 00:00:00 2001 From: Stefan Verhoeven Date: Mon, 26 Jun 2023 11:09:15 +0200 Subject: [PATCH 2/2] Let grpc do validation instead of typeguard Typeguard does not seem to work on Optional[str] as ```python from typing import Optional from typeguard import typechecked @typechecked() def foo(filename: Optional[str] = None) -> None: print(filename) foo(42) ``` Raises no error --- grpc4bmi/bmi_grpc_client.py | 2 -- test/test_client.py | 3 +-- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/grpc4bmi/bmi_grpc_client.py b/grpc4bmi/bmi_grpc_client.py index 2db4cfe..b16243f 100644 --- a/grpc4bmi/bmi_grpc_client.py +++ b/grpc4bmi/bmi_grpc_client.py @@ -9,7 +9,6 @@ from bmipy import Bmi import grpc import numpy -from typeguard import typechecked from grpc_status import rpc_status from google.rpc import error_details_pb2 @@ -94,7 +93,6 @@ def get_unique_port(host=None): s.bind(("" if host is None else host, 0)) return int(s.getsockname()[1]) - @typechecked def initialize(self, filename: Optional[str]): fname = "" if filename is None else filename try: diff --git a/test/test_client.py b/test/test_client.py index 26419a4..9017f2a 100644 --- a/test/test_client.py +++ b/test/test_client.py @@ -9,7 +9,6 @@ from google.rpc import error_details_pb2, status_pb2, code_pb2 from grpc_status import rpc_status from heat import BmiHeat -from typeguard import TypeCheckError from grpc4bmi.bmi_grpc_server import BmiServer from grpc4bmi.bmi_grpc_client import BmiClient, RemoteException, handle_error @@ -109,7 +108,7 @@ def test_initialize(): def test_initialize_with_nonstring(): client, local = make_bmi_classes(False) assert client is not None - with pytest.raises(TypeCheckError, match='did not match any element in the union'): + with pytest.raises(TypeError, match='bad argument type for built-in operation'): client.initialize(42) client.finalize() del client