Commit 8a630d4d authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

Fixed import issues within tests. Fixed test _radiometric_transform.

parent 30ac11f5
Pipeline #2920 failed with stages
in 4 minutes and 18 seconds
......@@ -33,6 +33,12 @@ path_enptlib = os.path.dirname(pkgutil.get_loader("enpt").path)
path_options_default = os.path.join(path_enptlib, 'options', 'options_default.json')
config_for_testing = dict(
path_l1b_enmap_image=os.path.join(path_enptlib, 'tests', 'data', 'EnMAP_Level_1B', 'AlpineTest1_CWV2_SM0.zip'),
output_dir=os.path.join(path_enptlib, 'tests', 'data', 'test_outputs')
)
class EnPTConfig(object):
def __init__(self, json_config='', **user_opts):
"""Create a job configuration.
......@@ -83,7 +89,7 @@ class EnPTConfig(object):
# toa_ref
self.path_earthSunDist = self.absPath(gp('path_earthSunDist'))
self.path_solar_irr = self.absPath(gp('path_solar_irr'))
self.scale_factor_toa_ref = gp('scale_factor_toa_ref'),
self.scale_factor_toa_ref = gp('scale_factor_toa_ref')
# geometry
self.enable_keystone_correction = gp('enable_keystone_correction')
......
# -*- coding: utf-8 -*-
import os
enptRepo_rootpath = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
config_for_testing = dict(
path_l1b_enmap_image=os.path.join(enptRepo_rootpath, 'tests', 'data', 'EnMAP_Level_1B', 'AlpineTest1_CWV2_SM0.zip'),
output_dir=os.path.join(enptRepo_rootpath, 'tests', 'data', 'test_outputs')
)
......@@ -13,10 +13,10 @@ import os
from runpy import run_path
from multiprocessing import cpu_count
from enpt import __path__
import enpt
path_run_enpt = os.path.abspath(os.path.join(__path__[0], '..', 'bin', 'enpt_cli.py'))
path_run_enpt = os.path.abspath(os.path.join(enpt.__path__[0], '..', 'bin', 'enpt_cli.py'))
class Test_CLIParser(TestCase):
......
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
......@@ -11,7 +12,7 @@ from json import \
dumps, \
JSONDecodeError
from unittest import TestCase
from unittest import TestCase, main
from enpt.options.config import \
get_options, \
......@@ -87,3 +88,7 @@ class Test_EnPTConfig(TestCase):
# check validity
EnPTValidator(allow_unknown=True, schema=enpt_schema_config_output).validate(params)
if __name__ == '__main__':
main()
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
......@@ -7,12 +8,11 @@ test_controller
Tests for `execution.controller` module.
"""
from unittest import TestCase
from unittest import TestCase, main
import shutil
from enpt.execution.controller import EnPT_Controller
from . import config_for_testing
from enpt.options.config import config_for_testing
class Test_EnPT_Controller(TestCase):
......@@ -25,3 +25,7 @@ class Test_EnPT_Controller(TestCase):
def test_run_all_processors(self):
self.CTR.run_all_processors()
if __name__ == '__main__':
main()
......@@ -17,8 +17,7 @@ import zipfile
from datetime import datetime
import shutil
from enpt.options.config import EnPTConfig
from . import config_for_testing
from enpt.options.config import EnPTConfig, config_for_testing
class Test_L1B_Reader(unittest.TestCase):
......
# -*- coding: utf-8 -*-
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import unittest
from unittest import TestCase, main
from glob import glob
import tempfile
import zipfile
from datetime import datetime
from enpt.processors import Radiometric_Transformer
from enpt.options.config import EnPTConfig
from enpt.options.config import EnPTConfig, config_for_testing
from . import config_for_testing
class Test_Radiometric_Transformer(unittest.TestCase):
class Test_Radiometric_Transformer(TestCase):
def setUp(self):
"""Set up the needed test data"""
self.cfg = EnPTConfig(**config_for_testing)
self.pathList_testimages = glob(os.path.join(os.path.dirname(__file__), "data", "EnMAP_Level_1B", "*.zip"))
self.RT = Radiometric_Transformer(config=self.cfg)
......@@ -48,3 +46,7 @@ class Test_Radiometric_Transformer(unittest.TestCase):
self.assertIsInstance(L1_obj, EnMAPL1Product_SensorGeo)
self.assertTrue(L1_obj.vnir.detector_meta.unitcode == 'TOARef')
self.assertTrue(L1_obj.swir.detector_meta.unitcode == 'TOARef')
if __name__ == "__main__":
main()
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