Skip to content

Commit 3431f68

Browse files
authored
Fix test pipeline (#680)
* Pinned upper version of dependencies ✨ * Using importlib is the prefered way to replace pkg_resources. 👒 * Notebook doesn't exist anymore. 🔐
1 parent 3d4bd0d commit 3431f68

File tree

4 files changed

+8
-11
lines changed

4 files changed

+8
-11
lines changed

environment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ dependencies:
5555
# casacore hast just no-mpi & open-mpi, but no mpich-wheel
5656
- conda-forge::fftw =*=mpi_mpich* # oskarpy(oskar(casacore)), tools21cm, bluebild(finufft) -> from conda-forge to ignore channel-prio & not take our legacy fftw-wheel
5757
# exclude buggy versions of other tools
58-
- setuptools !=71.0.0, !=71.0.1, !=71.0.2 # buggy with `importlib_metadata`
58+
- setuptools >=69.0.0,<70.0.0 # pkg_resources required by ska_sdp_datamodels and karabo code
5959
# for MWA measurement set, uvfits, hdf5, mir support (choc-234)
6060
# this [casa] syntax won't work with mamba!
6161
- pyuvdata[casa] >=2.4,<3

karabo/simulation/signal/seg_u_net_segmentation.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
"""Segmentation with SegU-net."""
22

3+
from importlib.resources import files
34
from typing import Literal
45

5-
import pkg_resources
66
import tools21cm as t2c
77
from typing_extensions import assert_never
88

@@ -78,15 +78,19 @@ def __init__(self, tta: _TtaType = 1, verbose: bool = False) -> None:
7878
self.NR_MANIP = len(self.MANIP)
7979

8080
# load model
81+
MODEL_NAME = "segunet_02-10T23-52-36_128slice_ep56.h5"
82+
MODEL_FILENAME = str(files("tool21cm").joinpath(f"input_data/{MODEL_NAME}"))
83+
"""
8184
MODEL_NAME = pkg_resources.resource_filename(
8285
"tools21cm", "input_data/segunet_02-10T23-52-36_128slice_ep56.h5"
8386
)
87+
"""
8488
METRICS = {
8589
"balanced_cross_entropy": t2c.segmentation.balanced_cross_entropy,
8690
"iou": t2c.segmentation.iou,
8791
"dice_coef": t2c.segmentation.dice_coef,
8892
}
89-
self.MODEL_LOADED = load_model(MODEL_NAME, custom_objects=METRICS)
93+
self.MODEL_LOADED = load_model(MODEL_FILENAME, custom_objects=METRICS)
9094
print(f" Loaded model: {MODEL_NAME}")
9195
# pylint: enable=invalid-name
9296

karabo/test/test_notebooks.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,6 @@ def test_source_detection_assessment_notebook() -> None:
5959
_run_notebook(notebook="source_detection_assessment.ipynb")
6060

6161

62-
@pytest.mark.skipif(
63-
IS_GITHUB_RUNNER or not RUN_NOTEBOOK_TESTS,
64-
reason="'Error: The operation was canceled' when running this test on the package",
65-
)
66-
def test_LineEmission_notebook() -> None:
67-
_run_notebook(notebook="LineEmissionBackendsComparison.ipynb")
68-
69-
7062
@pytest.mark.skipif(
7163
not RUN_NOTEBOOK_TESTS,
7264
reason="'Error: The operation was canceled' when running this test on the package",

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,5 +58,6 @@ testpaths = "karabo/test"
5858
'sphinx',
5959
'sphinx_rtd_theme',
6060
'types-requests', # types for mypy
61+
'types-setuptools==69.0.0.0',
6162
'versioneer',
6263
]

0 commit comments

Comments
 (0)