Skip to content
Snippets Groups Projects
Commit e6522f9b authored by Kristin Berry's avatar Kristin Berry Committed by Jesse Mapel
Browse files

Added ctx IsisSpice driver load test (#415)


* Added ctx IsisSpice driver load test

* Update conftest.py

Co-authored-by: default avatarKristin Berry <kberry@gyro.wr.usgs.gov>
parent b7c7f068
No related branches found
No related tags found
No related merge requests found
...@@ -97,6 +97,20 @@ def get_image_label(image, label_type='pds3'): ...@@ -97,6 +97,20 @@ def get_image_label(image, label_type='pds3'):
return label_file[0] return label_file[0]
def get_image(image):
if not isinstance(image, str):
try:
image = str(image)
except:
raise KeyError('Cannot coerce requested image name to string')
label_file = glob(os.path.join(data_root, '*',f'{image}.cub'))
if not label_file:
raise Exception(f'Could not find label file for {image}')
return label_file[0]
def get_table_data(image, table_name): def get_table_data(image, table_name):
if not isinstance(image, str): if not isinstance(image, str):
try: try:
......
This diff is collapsed.
This diff is collapsed.
...@@ -10,7 +10,7 @@ import spiceypy as spice ...@@ -10,7 +10,7 @@ import spiceypy as spice
import ale import ale
from ale.drivers.mro_drivers import MroCtxPds3LabelNaifSpiceDriver, MroCtxIsisLabelNaifSpiceDriver, MroCtxIsisLabelIsisSpiceDriver from ale.drivers.mro_drivers import MroCtxPds3LabelNaifSpiceDriver, MroCtxIsisLabelNaifSpiceDriver, MroCtxIsisLabelIsisSpiceDriver
from conftest import get_image_kernels, get_isd, convert_kernels, get_image_label, compare_dicts from conftest import get_image, get_image_kernels, get_isd, convert_kernels, get_image_label, compare_dicts
#@pytest.fixture #@pytest.fixture
# def ctx_isf # def ctx_isf
...@@ -23,15 +23,21 @@ def test_kernels(): ...@@ -23,15 +23,21 @@ def test_kernels():
for kern in binary_kernels: for kern in binary_kernels:
os.remove(kern) os.remove(kern)
@pytest.mark.parametrize("label_type", ['pds3', 'isis3']) @pytest.mark.parametrize("label_type, kernel_type", [('pds3', 'naif'), ('isis3', 'naif'), ('isis3', 'isis')])
def test_mro_load(test_kernels, label_type): def test_mro_load(test_kernels, label_type, kernel_type):
label_file = get_image_label('B10_013341_1010_XN_79S172W', label_type) label_file = get_image_label('B10_013341_1010_XN_79S172W', label_type)
if label_type == 'isis3' and kernel_type == 'isis':
label_file = get_image('B10_013341_1010_XN_79S172W')
isd_str = ale.loads(label_file)
compare_isd = get_isd('ctx_isis')
else:
isd_str = ale.loads(label_file, props={'kernels': test_kernels}) isd_str = ale.loads(label_file, props={'kernels': test_kernels})
compare_isd = get_isd('ctx')
isd_obj = json.loads(isd_str) isd_obj = json.loads(isd_str)
compare_isd = get_isd('ctx') if label_type == 'isis3' and kernel_type == 'naif':
if label_type == 'isis3':
compare_isd['image_samples'] = 5000 compare_isd['image_samples'] = 5000
assert compare_dicts(isd_obj, compare_isd) == [] assert compare_dicts(isd_obj, compare_isd) == []
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment