Commit a0eb6913 authored by Pierre Paleo's avatar Pierre Paleo
Browse files

Make scipy optional for tests

scipy should not be a nabu dependency
parent 384f81ce
Pipeline #28359 failed with stages
in 2 minutes and 30 seconds
......@@ -2,8 +2,12 @@ import pytest
import numpy as np
import os
import h5py
import scipy.ndimage
from silx.third_party.EdfFile import EdfFile
try:
import scipy.ndimage
__has_scipy__ = True
except ImportError:
__has_scipy__ = False
from nabu.preproc.alignment import CenterOfRotation, DetectorTranslationAlongBeam, AlignmentBase
from nabu.testutils import utilstest
......@@ -142,6 +146,7 @@ class TestCor(object):
message = "Computed CoR %f " % cor_position + " and real CoR %f do not coincide" % self.px
assert np.abs(self.px - cor_position) < self.abs_tol, message
@pytest.mark.skipif(not(__has_scipy__), reason="need scipy for this test")
def test_noisyHF_cor_posx(self):
""" test with noise at high frequencies
"""
......@@ -231,6 +236,7 @@ class TestDetectorTranslation(object):
message = "Computed shifts %s and expected %s do not coincide" % (found_shifts_list, self.reference_shifts_list)
assert np.all(np.isclose(found_shifts_list, self.reference_shifts_list, atol=self.abs_tol)), message
@pytest.mark.skipif(not(__has_scipy__), reason="need scipy for this test")
def test_alignxc_synth(self):
T_calc = DetectorTranslationAlongBeam()
......
......@@ -2,11 +2,14 @@ import pytest
import numpy as np
from nabu.preproc.shift import VerticalShift
import math
from scipy.ndimage import shift as ndshift
from nabu.cuda.utils import __has_pycuda__, get_cuda_context
if __has_pycuda__:
from nabu.preproc.shift_cuda import CudaVerticalShift, garray
try:
from scipy.ndimage import shift as ndshift
__has_scipy__ = True
except ImportError:
__has_scipy__ = False
@pytest.fixture(scope='class')
def bootstrap(request):
......@@ -35,7 +38,7 @@ def bootstrap(request):
if __has_pycuda__:
cls.ctx = get_cuda_context()
@pytest.mark.skipif(not(__has_scipy__), reason="need scipy for this test")
@pytest.mark.usefixtures('bootstrap')
class TestVerticalShift:
def test_vshift(self):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment