Skip to content

Commit c661b68

Browse files
committed
Add scikit-image to test deps, fix bare import in test_moments
1 parent 4b99e1b commit c661b68

2 files changed

Lines changed: 11 additions & 8 deletions

File tree

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ test-headless = [
8282
"pytest",
8383
"numpy",
8484
"hypothesis",
85-
"opencv-python-headless"
85+
"opencv-python-headless",
86+
"scikit-image"
8687
]
8788

8889
[project.urls]

tests/test_moments.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
import numpy as np
44
import cv2
5-
from skimage import data
5+
import pytest
6+
7+
skimage_data = pytest.importorskip("skimage.data")
68

79
import rlemasklib
810

@@ -34,17 +36,17 @@ def test_rectangle(self):
3436
self._compare_moments(mask)
3537

3638
def test_coins_thresholded(self):
37-
coins = data.coins()
39+
coins = skimage_data.coins()
3840
mask = (coins > 100).astype(np.uint8)
3941
self._compare_moments(mask)
4042

4143
def test_camera_thresholded(self):
42-
camera = data.camera()
44+
camera = skimage_data.camera()
4345
mask = (camera > 128).astype(np.uint8)
4446
self._compare_moments(mask)
4547

4648
def test_text_thresholded(self):
47-
text = data.text()
49+
text = skimage_data.text()
4850
mask = (text < 100).astype(np.uint8)
4951
self._compare_moments(mask)
5052

@@ -99,17 +101,17 @@ def test_rectangle(self):
99101
self._compare_hu_moments(mask)
100102

101103
def test_coins_thresholded(self):
102-
coins = data.coins()
104+
coins = skimage_data.coins()
103105
mask = (coins > 100).astype(np.uint8)
104106
self._compare_hu_moments(mask)
105107

106108
def test_camera_thresholded(self):
107-
camera = data.camera()
109+
camera = skimage_data.camera()
108110
mask = (camera > 128).astype(np.uint8)
109111
self._compare_hu_moments(mask)
110112

111113
def test_text_thresholded(self):
112-
text = data.text()
114+
text = skimage_data.text()
113115
mask = (text < 100).astype(np.uint8)
114116
self._compare_hu_moments(mask)
115117

0 commit comments

Comments
 (0)