Skip to content

Commit

Permalink
add gh actions
Browse files Browse the repository at this point in the history
  • Loading branch information
magland committed Mar 15, 2024
1 parent af7ffc7 commit d848052
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 5 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/integration_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: integration tests

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest
name: Test
steps:
- uses: actions/checkout@v1
- name: Install
run: pip install -e .
- name: Install packages needed for tests
# pyright 1.1.336 can produce annoying errors
run: pip install pytest pytest-cov pyright==1.1.335
- name: Run tests and collect coverage
run: pyright && pytest --cov lindi --cov-report=xml --cov-report=term tests/
# - uses: codecov/codecov-action@v3
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
# fail_ci_if_error: true
# file: ./coverage.xml
# flags: unittests
22 changes: 22 additions & 0 deletions .github/workflows/linter_checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: linter-checks

on:
push:
pull_request:
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
name: Linter checks
steps:
- uses: actions/checkout@v1
- name: Install
run: pip install -e .
- name: Install packages needed for tests
# pyright 1.1.336 can produce annoying errors
run: pip install pyright==1.1.335 flake8
- name: Run flake8
run: flake8 --config .flake8
- name: Run pyright
run: pyright
4 changes: 3 additions & 1 deletion devel/old_tests/test_lindi_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ def test_lindi_client():
for k in acquisition.keys():
print(k)

x = client["acquisition/ElectricalSeriesAp"]["data"]
aa = client["acquisition/ElectricalSeriesAp"]
assert isinstance(aa, LindiGroup)
x = aa["data"]
assert isinstance(x, LindiDataset)

print(x.shape)
Expand Down
6 changes: 4 additions & 2 deletions examples/example1.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import numpy as np
import h5py
import tempfile
import lindi
from lindi import LindiH5Store, LindiClient, LindiDataset
from _check_equal import _check_equal

Expand Down Expand Up @@ -76,8 +77,9 @@ def example1():
G1 = h5f["group"]
G2 = client["group"]
for k, v in G1.attrs.items():
assert k in G2.attrs
assert _check_equal(v, G2.attrs[k])
if not isinstance(G2, lindi.LindiReference):
assert k in G2.attrs
assert _check_equal(v, G2.attrs[k])

print("Comparing root group")
for k, v in h5f.attrs.items():
Expand Down
1 change: 1 addition & 0 deletions lindi/LindiClient/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
from .LindiGroup import LindiGroup # noqa: F401
from .LindiDataset import LindiDataset # noqa: F401
from .LindiAttributes import LindiAttributes # noqa: F401
from .LindiGroup import LindiReference # noqa: F401
2 changes: 1 addition & 1 deletion lindi/LindiH5Store/LindiH5Store.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ def _get_chunk_names_for_dataset(chunk_coords_shape: List[int]) -> List[str]:
return names


def _reformat_json(x: bytes):
def _reformat_json(x: Union[bytes, None]) -> Union[bytes, None]:
if x is None:
return None
return json.dumps(json.loads(x.decode("utf-8"))).encode("utf-8")
2 changes: 1 addition & 1 deletion lindi/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
from .LindiClient import LindiClient, LindiGroup, LindiDataset, LindiAttributes # noqa: F401
from .LindiClient import LindiClient, LindiGroup, LindiDataset, LindiAttributes, LindiReference # noqa: F401
from .LindiH5Store import LindiH5Store, LindiH5StoreOpts # noqa: F401

0 comments on commit d848052

Please sign in to comment.