Commit 334e7df7 authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

Added "if __name__ == '__main__'" blocks below test modules to ensure tests...


Added "if __name__ == '__main__'" blocks below test modules to ensure tests are also running properly on Windows. Bumped version.
Signed-off-by: Daniel Scheffler's avatarDaniel Scheffler <danschef@gfz-potsdam.de>
parent 57fb3bcb
Pipeline #20115 passed with stages
in 10 minutes and 53 seconds
......@@ -2,6 +2,12 @@
History
=======
0.17.2 (2021-03-04)
-------------------
* Added "if __name__ == '__main__'" blocks below test modules to ensure tests are also running properly on Windows.
0.17.1 (2021-02-23)
-------------------
......
......@@ -201,6 +201,4 @@ if __name__ == '__main__':
parsed_args = get_enpt_argparser().parse_args()
parsed_args.func(get_config(parsed_args))
print('\nready.')
......@@ -27,6 +27,6 @@
# You should have received a copy of the GNU Lesser General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
__version__ = '0.17.1'
__versionalias__ = '20210223.01'
__version__ = '0.17.2'
__versionalias__ = '20210304.01'
__author__ = 'Daniel Scheffler'
......@@ -117,3 +117,8 @@ class Test_CLIParser(TestCase):
self.baseargs + ['--json_config', '{"general_opts": {"CPUs": "None"}}'])
config = self.get_config(parsed_args)
self.assertEqual(config.CPUs, cpu_count())
if __name__ == '__main__':
import nose2
nose2.main()
......@@ -39,7 +39,7 @@ from json import \
dumps, \
JSONDecodeError
from unittest import TestCase, main
from unittest import TestCase
from enpt.options.config import \
get_options, \
......@@ -124,4 +124,5 @@ class Test_EnPTConfig(TestCase):
if __name__ == '__main__':
main()
import nose2
nose2.main()
......@@ -35,7 +35,7 @@ test_controller
Tests for `execution.controller` module.
"""
from unittest import TestCase, main
from unittest import TestCase
import shutil
from enpt.execution.controller import EnPT_Controller
......@@ -69,4 +69,5 @@ class Test_EnPT_Controller_DLR_testdata(TestCase):
if __name__ == '__main__':
main()
import nose2
nose2.main()
......@@ -243,3 +243,8 @@ class Test_interp_nodata_spatially_2d(TestCase):
interp_nodata_spatially_2d(self.get_data2d(), nodata=np.array([1, 2, 3]))
with self.assertRaises(ValueError):
interp_nodata_spatially_2d(self.get_data2d(), implementation='invalid')
if __name__ == '__main__':
import nose2
nose2.main()
......@@ -109,3 +109,8 @@ class Test_DEM_Processor(TestCase):
dem_sensor_geo = self.DP_mapgeo.to_sensor_geometry(lons=self.lons, lats=self.lats)
self.assertEqual(dem_sensor_geo.shape, (100, 1000))
if __name__ == '__main__':
import nose2
nose2.main()
......@@ -127,3 +127,8 @@ class Test_EnMAPL1Product_SensorGeo(TestCase):
finally:
self.L1_obj.meta.vnir.lons = vnir_lons
self.assertIsInstance(self.L1_obj.meta.vnir.lons, np.ndarray)
if __name__ == '__main__':
import nose2
nose2.main()
......@@ -192,5 +192,6 @@ class Test_L1B_Reader_DLR(unittest.TestCase):
self.assertEquals(L1_obj.swir.detector_meta.nwvl, 130)
if __name__ == "__main__":
unittest.main()
if __name__ == '__main__':
import nose2
nose2.main()
......@@ -189,3 +189,8 @@ class Test_VNIR_SWIR_Stacker(TestCase):
# wrong input algorithm
with self.assertRaises(ValueError):
self.VSSt.compute_stack(algorithm='mean')
if __name__ == '__main__':
import nose2
nose2.main()
......@@ -29,7 +29,7 @@
# with this program. If not, see <http://www.gnu.org/licenses/>.
import os
from unittest import TestCase, main
from unittest import TestCase
import tempfile
import zipfile
......@@ -75,5 +75,6 @@ class Test_Radiometric_Transformer(TestCase):
self.assertTrue(L1_obj.swir.detector_meta.unitcode == 'TOARef')
if __name__ == "__main__":
main()
if __name__ == '__main__':
import nose2
nose2.main()
......@@ -77,3 +77,8 @@ class Test_Spatial_Optimizer(TestCase):
self.assertNotEqual(np.std(L1_obj.meta.vnir.lons), 0)
self.assertNotEqual(np.mean(L1_obj.meta.vnir.lats), 0)
self.assertNotEqual(np.std(L1_obj.meta.vnir.lats), 0)
if __name__ == '__main__':
import nose2
nose2.main()
......@@ -356,3 +356,8 @@ class Test_RPC_3D_Geolayer_Generator(TestCase):
self.assertEqual(lons.shape, (1024, 1000, 6))
self.assertFalse(np.array_equal(lons[:, :, 0], lons[:, :, 2]))
self.assertFalse(np.array_equal(lats[:, :, 0], lats[:, :, 2]))
if __name__ == '__main__':
import nose2
nose2.main()
......@@ -49,3 +49,8 @@ class Test_SRF(TestCase):
def test_from_cwl_fwhm(self):
srf = SRF.from_cwl_fwhm(cwls=[800, 1000], fwhms=[10, 20])
self.assertIsInstance(srf, SRF)
if __name__ == '__main__':
import nose2
nose2.main()
Markdown is supported
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