1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269
|
From: =?utf-8?q?=C3=89tienne_Mollier?= <emollier@debian.org>
Date: Fri, 3 Dec 2021 22:47:26 +0100
Subject: skip tests needing internet
Forwarded: not-needed
Last-Update: 2021-12-03
Last-Update: 2021-12-03
---
dipy/align/tests/test_api.py | 9 +++++++++
dipy/data/tests/test_fetcher.py | 3 ++-
dipy/direction/tests/test_ptt_direction_getter.py | 3 ++-
dipy/workflows/tests/test_io.py | 2 ++
4 files changed, 15 insertions(+), 2 deletions(-)
--- dipy.orig/dipy/align/tests/test_api.py
+++ dipy/dipy/align/tests/test_api.py
@@ -34,6 +34,7 @@
from dipy.tracking.utils import transform_tracking_output
+@pytest.mark.skip(reason="test needs internet")
def setup_module():
global \
subset_b0, \
@@ -61,6 +62,7 @@
subset_t2_img = nib.Nifti1Image(subset_t2, MNI_T2_affine)
+@pytest.mark.skip(reason="test needs internet")
def test_syn_registration():
with TemporaryDirectory() as tmpdir:
warped_moving, mapping = syn_registration(
@@ -97,6 +99,7 @@
)
+@pytest.mark.skip(reason="test needs internet")
def test_register_dwi_to_template():
# Default is syn registration:
warped_b0, mapping = register_dwi_to_template(
@@ -125,6 +128,7 @@
npt.assert_(affine_mat.shape == (4, 4))
+@pytest.mark.skip(reason="test needs internet")
def test_affine_registration():
moving = subset_b0
static = subset_b0
@@ -256,6 +260,7 @@
npt.assert_almost_equal(affine_mat[:3, :3], np.eye(3), decimal=1)
+@pytest.mark.skip(reason="test needs internet")
def test_single_transforms():
moving = subset_b0
static = subset_b0
@@ -284,6 +289,7 @@
npt.assert_almost_equal(affine_mat[:3, :3], np.eye(3), decimal=1)
+@pytest.mark.skip(reason="test needs internet")
def test_register_series():
fdata, fbval, fbvec = dpd.get_fnames(name="small_64D")
img = nib.load(fdata)
@@ -294,6 +300,7 @@
npt.assert_(np.all(xformed[..., ref_idx] == img.get_fdata()[..., ref_idx]))
+@pytest.mark.skip(reason="test might need internet")
def test_register_dwi_series_and_motion_correction():
fdata, fbval, fbvec = dpd.get_fnames(name="small_64D")
with TemporaryDirectory() as tmpdir:
@@ -317,6 +324,7 @@
npt.assert_array_equal(reg_affines, reg_affines_2)
+@pytest.mark.skip(reason="test needs internet")
@set_random_number_generator()
def test_streamline_registration(rng):
sl1 = [
@@ -372,6 +380,7 @@
npt.assert_almost_equal(aligned[1], sl1[1], decimal=5)
+@pytest.mark.skip(reason="test needs internet")
def test_register_dwi_series_multi_b0():
# Test if register_dwi_series works with multiple b0 images
dwi_fname, dwi_bval_fname, dwi_bvec_fname = dpd.get_fnames(name="sherbrooke_3shell")
--- dipy.orig/dipy/data/tests/test_fetcher.py
+++ dipy/dipy/data/tests/test_fetcher.py
@@ -2,6 +2,7 @@
import importlib
import os
import os.path as op
+import pytest
import tempfile
from threading import Thread
from urllib.request import pathname2url
@@ -87,7 +88,7 @@
# change to original working directory
os.chdir(current_dir)
-
+@pytest.mark.skip(reason="test skewed by dummy proxy setup")
def test_fetch_data():
symmetric362 = SPHERE_FILES["symmetric362"]
with tempfile.TemporaryDirectory() as tmpdir:
--- dipy.orig/dipy/direction/tests/test_ptt_direction_getter.py
+++ dipy/dipy/direction/tests/test_ptt_direction_getter.py
@@ -19,8 +19,9 @@
from dipy.tracking.local_tracking import LocalTracking
from dipy.tracking.stopping_criterion import BinaryStoppingCriterion
from dipy.tracking.streamline import Streamlines
+import pytest
-
+@pytest.mark.skip(reason="test needs internet")
def test_ptt_tracking():
# Test PTT direction getter generate 100 streamlines with more than 1 pts.
fod_fname, seed_coordinates_fname, _ = get_fnames(name="ptt_minimal_dataset")
--- dipy.orig/dipy/workflows/tests/test_io.py
+++ dipy/dipy/workflows/tests/test_io.py
@@ -6,6 +6,7 @@
import shutil
import sys
from tempfile import TemporaryDirectory, mkstemp
+import pytest
import numpy as np
import numpy.testing as npt
@@ -89,6 +90,7 @@
pass
+@pytest.mark.skip(reason="test needs internet")
def test_io_fetch():
fetch_flow = FetchFlow()
with TemporaryDirectory() as out_dir:
--- dipy.orig/dipy/tracking/tests/test_propspeed.pyx
+++ dipy/dipy/tracking/tests/test_propspeed.pyx
@@ -22,6 +22,8 @@
from dipy.tracking.tests.test_tractogen import get_fast_tracking_performances
from dipy.utils.fast_numpy cimport RNGState, seed_rng
+import pytest
+
def test_tracker_deterministic():
# Test the probabilistic tracker function
@@ -84,6 +86,7 @@
def test_deterministic_performances():
# Test deterministic tracker on the DiSCo dataset
+ pytest.skip(reason="test needs internet")
params = generate_tracking_parameters("det",
max_len=500,
step_size=0.2,
@@ -156,6 +159,7 @@
def test_probabilistic_performances():
# Test probabilistic tracker on the DiSCo dataset
+ pytest.skip(reason="test needs internet")
params = generate_tracking_parameters("prob",
max_len=500,
step_size=0.2,
@@ -229,6 +233,7 @@
def test_ptt_performances():
# Test ptt tracker on the DiSCo dataset
+ pytest.skip(reason="test needs internet")
params = generate_tracking_parameters("ptt",
max_len=500,
--- dipy.orig/dipy/tracking/tests/test_tracker.py
+++ dipy/dipy/tracking/tests/test_tracker.py
@@ -12,6 +12,8 @@
from dipy.tracking.streamline import Streamlines
from dipy.tracking.utils import random_seeds_from_mask
+import pytest
+
def track(method, **kwargs):
"""This tests that the number of streamlines equals the number of seeds
@@ -80,6 +82,7 @@
npt.assert_array_less(len(streamlines), len(seeds))
+@pytest.mark.skip(reason="test needs internet")
def test_deterministic_tracking():
with warnings.catch_warnings():
warnings.filterwarnings(
@@ -91,6 +94,7 @@
track(tracker.deterministic_tracking, use_sf=True, use_dirs=True)
+@pytest.mark.skip(reason="test needs internet")
def test_probabilistic_tracking():
with warnings.catch_warnings():
warnings.filterwarnings(
@@ -102,6 +106,7 @@
track(tracker.probabilistic_tracking, use_sf=True, use_dirs=True)
+@pytest.mark.skip(reason="test needs internet")
def test_ptt_tracking():
with warnings.catch_warnings():
warnings.filterwarnings(
--- dipy.orig/dipy/tracking/tests/test_tractogen.pyx
+++ dipy/dipy/tracking/tests/test_tractogen.pyx
@@ -16,6 +16,7 @@
from dipy.tracking.utils import (connectivity_matrix, random_seeds_from_mask,
seeds_from_mask, seeds_directions_pairs)
+import pytest
def get_fast_tracking_performances(params, *, nbr_seeds=1000, nbr_threads=0):
@@ -88,6 +89,7 @@
def test_tractogram_reproducibility():
# Test tractogram reproducibility
+ pytest.skip(reason="test needs internet")
params0 = generate_tracking_parameters("prob",
max_len=500,
step_size=0.2,
@@ -129,6 +131,8 @@
"""This tests that the angle between streamline points is always smaller
then the input `max_angle` parameter.
"""
+ pytest.skip(reason="test needs internet")
+ pytest.skip(reason="test needs internet")
def get_min_cos_similarity(streamlines):
min_cos_sim = 1
@@ -163,6 +167,7 @@
"""This tests that the distance between streamline
points is equal to the input `step_size` parameter.
"""
+ pytest.skip(reason="test needs internet")
def get_points_distance(streamlines):
dists = []
@@ -189,7 +194,7 @@
"""This tests that the number of streamlines equals the number of seeds
when return_all=True.
"""
-
+ pytest.skip(reason="test needs internet")
fnames = get_fnames(name="disco1", include_optional=True)
sphere = HemiSphere.from_sphere(get_sphere(name="repulsion724"))
@@ -248,6 +253,7 @@
def test_max_min_length():
"""This tests that the returned streamlines respect the length criterion.
"""
+ pytest.skip(reason="test needs internet")
fnames = get_fnames(name="disco1", include_optional=True)
sphere = HemiSphere.from_sphere(get_sphere(name="repulsion724"))
sh = nib.load(fnames[20]).get_fdata()
@@ -293,6 +299,7 @@
def test_buffer_frac():
"""This tests that the buffer fraction for generate tractogram plays well.
"""
+ pytest.skip(reason="test needs internet")
fnames = get_fnames(name="disco1", include_optional=True)
sphere = HemiSphere.from_sphere(get_sphere(name="repulsion724"))
sh = nib.load(fnames[20]).get_fdata()
|