Skip to content

Commit

Permalink
Thread bug fix (#133)
Browse files Browse the repository at this point in the history
Fix to isolate logging between threads.

Update of tests to remove EOL python versions, only 3.8 or newer supported.
  • Loading branch information
david-i-berry authored Mar 4, 2024
1 parent b176d38 commit 8ca5dfe
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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
Expand Down
12 changes: 8 additions & 4 deletions csv2bufr/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
# ============================
Expand Down Expand Up @@ -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()
2 changes: 0 additions & 2 deletions csv2bufr/templates/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
numpy==1.21.6
click
eccodes
jsonschema

0 comments on commit 8ca5dfe

Please sign in to comment.