Skip to content

Commit

Permalink
Fix some py unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
felixhekhorn committed Jan 10, 2025
1 parent 3d9c9b1 commit 4ed730f
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 79 deletions.
15 changes: 0 additions & 15 deletions .github/workflows/unittests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,7 @@ name: Python unit tests
on: push

jobs:
data:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get test data
id: cache-test-data
uses: actions/cache@v4
with:
path: test-data
key: test-data-v1
- name: Download test data
if: steps.cache-test-data.outputs.cache-hit != 'true'
run: |
./tests/data/assets.sh
test:
needs: data
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def _create(self):
lx = len(self.operator.xgrid)
lpids = len(self.operator.pids)
for mu2, op in self._operators(
mugrid=self.operator.evolgrid, shape=(lpids, lx)
mugrid=self.operator.evolgrid, shape=(lpids, lx, lpids, lx)
).items():
self.cache[mu2] = op

Expand Down
6 changes: 3 additions & 3 deletions tests/eko/io/test_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def test_metadata(tmp_path, caplog):
m.update()
assert "no file" in caplog.text
with pytest.raises(RuntimeError):
m.path
_ = m.path
# now modify
m.path = tmp_path
m.update()
Expand All @@ -22,11 +22,11 @@ def test_metadata(tmp_path, caplog):
assert p.metadata.is_file()
assert "version" in p.metadata.read_text()
# change version
m.version = "0.0.0-a1~really1.0.0"
m.version = "0.0.1"
m.update()
# if I read back the thing should be what I set
mn = metadata.Metadata(origin=(1.0, 3), xgrid=[0.1, 1.0])
mm = metadata.Metadata.load(tmp_path)
assert m.path == tmp_path
assert mm.version != mn.version
assert mm.version == "0.0.0-a1~really1.0.0"
assert mm.version == "0.0.1"
4 changes: 2 additions & 2 deletions tests/eko/io/test_struct.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def test_copy(self, eko_factory: EKOFactory, tmp_path: pathlib.Path):
mugrid = [(mu, nf)]
eko_factory.operator.mugrid = mugrid
eko1 = eko_factory.get()
v = np.random.rand(2, 2)
v = np.random.rand(2, 2, 2, 2)
opv = struct.Operator(operator=v)
eko1[ep] = opv
np.testing.assert_allclose(eko1[ep].operator, v)
Expand All @@ -128,7 +128,7 @@ def test_copy(self, eko_factory: EKOFactory, tmp_path: pathlib.Path):
with EKO.edit(p) as eko2:
np.testing.assert_allclose(eko1[ep].operator, v)
np.testing.assert_allclose(eko2[ep].operator, v)
vv = np.random.rand(2, 2)
vv = np.random.rand(2, 2, 2, 2)
opvv = struct.Operator(operator=vv)
eko2[ep] = opvv
np.testing.assert_allclose(eko1[ep].operator, v)
Expand Down
58 changes: 0 additions & 58 deletions tests/eko/runner/test_legacy.py

This file was deleted.

0 comments on commit 4ed730f

Please sign in to comment.