[pyfai] 12/22: unittest...
Frédéric-Emmanuel Picca
picca at moszumanska.debian.org
Wed Jun 8 14:33:56 UTC 2016
This is an automated email from the git hooks/post-receive script.
picca pushed a commit to annotated tag debian/0.12.0+dfsg-1
in repository pyfai.
commit cf2f2b96606f4044aa3b98811e7607decf9cdef6
Author: Picca Frédéric-Emmanuel <picca at synchrotron-soleil.fr>
Date: Wed Jun 8 11:20:14 2016 +0200
unittest...
---
debian/patches/0002-skip-test-if-no-network.patch | 107 +++++++++++++++++++++-
1 file changed, 104 insertions(+), 3 deletions(-)
diff --git a/debian/patches/0002-skip-test-if-no-network.patch b/debian/patches/0002-skip-test-if-no-network.patch
index 4b8474b..61df388 100644
--- a/debian/patches/0002-skip-test-if-no-network.patch
+++ b/debian/patches/0002-skip-test-if-no-network.patch
@@ -1,12 +1,113 @@
From: =?utf-8?q?Picca_Fr=C3=A9d=C3=A9ric-Emmanuel?=
<picca at synchrotron-soleil.fr>
-Date: Wed, 8 Jun 2016 09:40:15 +0200
+Date: Wed, 8 Jun 2016 11:19:37 +0200
Subject: skip test if no network
---
- pyFAI/test/utilstest.py | 13 ++++++++-----
- 1 file changed, 8 insertions(+), 5 deletions(-)
+ pyFAI/test/test_azimuthal_integrator.py | 4 +++-
+ pyFAI/test/test_csr.py | 22 ++++++++++++----------
+ pyFAI/test/test_integrate.py | 16 +++++++++-------
+ pyFAI/test/utilstest.py | 13 ++++++++-----
+ 4 files changed, 32 insertions(+), 23 deletions(-)
+diff --git a/pyFAI/test/test_azimuthal_integrator.py b/pyFAI/test/test_azimuthal_integrator.py
+index be03f8a..9de7e44 100644
+--- a/pyFAI/test/test_azimuthal_integrator.py
++++ b/pyFAI/test/test_azimuthal_integrator.py
+@@ -58,7 +58,9 @@ except ImportError:
+
+
+ class TestAzimPilatus(unittest.TestCase):
+- img = UtilsTest.getimage("1884/Pilatus6M.cbf")
++ @classmethod
++ def setUpClass(cls):
++ cls.img = UtilsTest.getimage("1884/Pilatus6M.cbf")
+
+ def setUp(self):
+ """Download files"""
+diff --git a/pyFAI/test/test_csr.py b/pyFAI/test/test_csr.py
+index 835f825..001afc0 100644
+--- a/pyFAI/test/test_csr.py
++++ b/pyFAI/test/test_csr.py
+@@ -49,11 +49,6 @@ if opencl.ocl:
+
+ import fabio
+
+-N = 1000
+-ai = AzimuthalIntegrator.sload(UtilsTest.getimage("1893/Pilatus1M.poni"))
+-data = fabio.open(UtilsTest.getimage("1883/Pilatus1M.edf")).data
+-ai.xrpd_LUT(data, N)
+-
+
+ class ParameterisedTestCase(unittest.TestCase):
+ """ TestCase classes that want to be parameterised should
+@@ -61,6 +56,13 @@ class ParameterisedTestCase(unittest.TestCase):
+ From Eli Bendersky's website
+ http://eli.thegreenplace.net/2011/08/02/python-unit-testing-parametrized-test-cases/
+ """
++ @classmethod
++ def setUpClass(cls):
++ cls.N = 1000
++ cls.ai = AzimuthalIntegrator.sload(UtilsTest.getimage("1893/Pilatus1M.poni"))
++ cls.data = fabio.open(UtilsTest.getimage("1883/Pilatus1M.edf")).data
++ cls.ai.xrpd_LUT(data, N)
++
+ def __init__(self, methodName='runTest', param=None):
+ super(ParameterisedTestCase, self).__init__(methodName)
+ self.param = param
+@@ -82,20 +84,20 @@ class ParamOpenclCSR(ParameterisedTestCase):
+
+ def test_csr(self):
+ workgroup_size = self.param
+- out_ref = splitBBox.histoBBox1d(data, ai.ttha, ai._cached_array["2th_delta"], bins=N)
+- csr = splitBBoxCSR.HistoBBox1d(ai.ttha, ai._cached_array["2th_delta"], bins=N, unit="2th_deg")
++ out_ref = splitBBox.histoBBox1d(self.data, self.ai.ttha, self.ai._cached_array["2th_delta"], bins=self.N)
++ csr = splitBBoxCSR.HistoBBox1d(self.ai.ttha, self.ai._cached_array["2th_delta"], bins=self.N, unit="2th_deg")
+ if not opencl.ocl:
+ skip = True
+ else:
+ try:
+- ocl_csr = ocl_azim_csr.OCL_CSR_Integrator(csr.lut, data.size, "ALL", profile=True, block_size=workgroup_size)
+- out_ocl_csr = ocl_csr.integrate(data)
++ ocl_csr = ocl_azim_csr.OCL_CSR_Integrator(csr.lut, self.data.size, "ALL", profile=True, block_size=workgroup_size)
++ out_ocl_csr = ocl_csr.integrate(self.data)
+ except (opencl.pyopencl.MemoryError, MemoryError):
+ logger.warning("Skipping test due to memory error on device")
+ skip = True
+ else:
+ skip = False
+- out_cyt_csr = csr.integrate(data)
++ out_cyt_csr = csr.integrate(self.data)
+ cmt = "Testing ocl_csr with workgroup_size= %s" % (workgroup_size)
+ logger.debug(cmt)
+ if skip:
+diff --git a/pyFAI/test/test_integrate.py b/pyFAI/test/test_integrate.py
+index 17efa5c..30466ba 100644
+--- a/pyFAI/test/test_integrate.py
++++ b/pyFAI/test/test_integrate.py
+@@ -110,13 +110,15 @@ class TestIntegrate1D(unittest.TestCase):
+
+
+ class TestIntegrate2D(unittest.TestCase):
+- npt = 500
+- img = UtilsTest.getimage("1883/Pilatus1M.edf")
+- data = fabio.open(img).data
+- ai = AzimuthalIntegrator(1.58323111834, 0.0334170169115, 0.0412277798782, 0.00648735642526, 0.00755810191106, 0.0, detector=Pilatus1M())
+- ai.wavelength = 1e-10
+- Rmax = 20
+- delta_pos_azim_max = 0.28
++ @classmethod
++ def setUpClass(cls):
++ cls.npt = 500
++ cls.img = UtilsTest.getimage("1883/Pilatus1M.edf")
++ cls.data = fabio.open(img).data
++ cls.ai = AzimuthalIntegrator(1.58323111834, 0.0334170169115, 0.0412277798782, 0.00648735642526, 0.00755810191106, 0.0, detector=Pilatus1M())
++ cls.ai.wavelength = 1e-10
++ cls.Rmax = 20
++ cls.delta_pos_azim_max = 0.28
+
+ def testQ(self):
+ res = {}
diff --git a/pyFAI/test/utilstest.py b/pyFAI/test/utilstest.py
index 812a311..0d48afe 100644
--- a/pyFAI/test/utilstest.py
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/pyfai.git
More information about the debian-science-commits
mailing list