Package: python-geotiepoints / 1.1.7-1

0002-Fix-tests.patch Patch series | download
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
From: Antonio Valentino <antonio.valentino@tiscali.it>
Date: Sun, 23 Dec 2018 10:36:27 +0000
Subject: Fix tests

---
 geotiepoints/tests/__init__.py | 23 ++++++++++++++++++-----
 setup.py                       |  2 +-
 2 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/geotiepoints/tests/__init__.py b/geotiepoints/tests/__init__.py
index 92150bc..b45394e 100644
--- a/geotiepoints/tests/__init__.py
+++ b/geotiepoints/tests/__init__.py
@@ -25,11 +25,19 @@
 from geotiepoints import interpolator
 
 from geotiepoints.tests import (test_geointerpolator,
-                                test_modis,
+                                # test_modis,
                                 test_satelliteinterpolator,
                                 test_interpolator,
                                 test_multilinear,
-                                test_modisinterpolator)
+                                #test_modisinterpolator,
+                                )
+
+import os
+_DATADIR = os.path.join(os.path.dirname(__file__), '../../testdata')
+try:
+    import h5py
+except ImportError:
+    h5py = False
 
 
 import sys
@@ -49,17 +57,22 @@ def suite():
     mysuite = unittest.TestSuite()
     if not TRAVIS:
         # Test sphinx documentation pages:
-        mysuite.addTests(doctest.DocFileSuite('../../doc/source/index.rst'))
+        if os.path.exists('../../doc/source/index.rst'):
+            mysuite.addTests(doctest.DocFileSuite('../../doc/source/index.rst'))
         # # Test the documentation strings
         mysuite.addTests(doctest.DocTestSuite(interpolator))
 
     # Use the unittests also
     mysuite.addTests(test_geointerpolator.suite())
-    mysuite.addTests(test_modis.suite())
+    if h5py and os.path.exists(_DATADIR):
+        from geotiepoints.tests import test_modis
+        mysuite.addTests(test_modis.suite())
     mysuite.addTests(test_satelliteinterpolator.suite())
     mysuite.addTests(test_interpolator.suite())
     mysuite.addTests(test_multilinear.suite())
-    mysuite.addTests(test_modisinterpolator.suite())
+    if h5py and os.path.exists(_DATADIR):
+        from geotiepoints.tests import test_modisinterpolator
+        mysuite.addTests(test_modisinterpolator.suite())
     return mysuite
 
 if __name__ == '__main__':
diff --git a/setup.py b/setup.py
index 69f7b3e..1f26003 100644
--- a/setup.py
+++ b/setup.py
@@ -132,7 +132,7 @@ if __name__ == "__main__":
                        "Programming Language :: Python",
                        "Topic :: Scientific/Engineering"],
           url="https://github.com/pytroll/python-geotiepoints",
-          packages=['geotiepoints'],
+          packages=['geotiepoints', 'geotiepoints.tests'],
           # packages=find_packages(),
           setup_requires=['numpy'],
           python_requires='>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*',