diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 8716222..291af5f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -7,11 +7,11 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.7, 3.8, 3.9] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 name: Setup Python ${{ matrix.python-version }} with: python-version: ${{ matrix.python-version }} @@ -33,8 +33,8 @@ jobs: python3 setup.py install mkdir -p /opt/csv2bufr cd /opt/csv2bufr - wget https://github.com/wmo-im/csv2bufr-templates/archive/refs/tags/v0.1.tar.gz - tar -zxf v0.1.tar.gz --strip-components=1 csv2bufr-templates-0.1/templates + wget https://github.com/wmo-im/csv2bufr-templates/archive/refs/tags/v0.2.tar.gz + tar -zxf v0.2.tar.gz --strip-components=1 csv2bufr-templates-0.2/templates - name: run tests ⚙️ run: | pytest diff --git a/csv2bufr/__init__.py b/csv2bufr/__init__.py index 4880bca..0e08263 100644 --- a/csv2bufr/__init__.py +++ b/csv2bufr/__init__.py @@ -513,9 +513,13 @@ def as_bufr(self, use_cached: bool = False) -> bytes: # set delayed replications, this is needed again as we only used it the # first time to set the keys if len(self.delayed_replications) > 0: - codes_set_array(bufr_msg, - "inputDelayedDescriptorReplicationFactor", - self.delayed_replications) + try: + codes_set_array(bufr_msg, + "inputDelayedDescriptorReplicationFactor", + self.delayed_replications) + except Exception as e: + msg = f"Error ({e}) setting inputDelayedDescriptorReplicationFactor" # noqa + raise RuntimeError(msg) # ============================ # iterate over keys and encode # ============================ @@ -973,6 +977,6 @@ def transform(data: str, mappings: dict) -> Iterator[dict]: # now yield result back to caller yield result # clear warnings - del _warnings_global[job_id] + _warnings_global[job_id] = [] fh.close() diff --git a/csv2bufr/templates/__init__.py b/csv2bufr/templates/__init__.py index 1265e6b..fe7c077 100644 --- a/csv2bufr/templates/__init__.py +++ b/csv2bufr/templates/__init__.py @@ -88,8 +88,6 @@ def load_template(template_name: str) -> Union[dict, None]: fname = None error_flag = False if template_name not in TEMPLATES: - msg = f"Requested template {template_name} not found, " +\ - "searching by file name" for _template in TEMPLATES.values(): if template_name == _template.get('name'): fname = _template.get('path') diff --git a/requirements.txt b/requirements.txt index f36f3f5..2107540 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,3 @@ -numpy==1.21.6 click eccodes jsonschema