Commit bf1ace64 authored by acpaquette's avatar acpaquette Committed by Jesse Mapel
Browse files

Basic Mro Load Test (#260)

* Initial stab at a unitest class based mro test suit

* Adds data area for MRO

* Updated platform name on mro for consistency

* Update mro tests

* Updated data naif tests

* Updated sun_position test after light time correction update

* Reverted the data_naif tests

* Updated MRO testing

* Update to master of data_naif tests

* Added stderr output to convert_kernels

* Print statement

* stderr print statement

* Subprocess try except

* Added text=True

* Removed assert false

* Simplified load

* made mro tests verbose

* More changes

* More conftest changes

* Removed changes to conftest

* Loading kernels in fixture again

* Added prints and removed fixture furnish

* Added back in mro loads test

* Changed fixture scope to module

* Added path truncation through a relative path

* Bits of cleanup for conftest and the mro tests

* Added verbose in travis file

* Added check for list type

* Final clean up for the mro tests and conftest

* Cleaned up imports and added full diff to travis
parent 62c7ca78
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -45,7 +45,7 @@ install:
  - conda install pytest

script:
  - PYTHONPATH=. pytest tests/pytests
  - PYTHONPATH=. pytest tests/pytests -vv
  - python setup.py install # install to use python lib in c code
  - mkdir -p build
  - cd build
+2 −2
Original line number Diff line number Diff line
@@ -75,6 +75,6 @@ def load(label, props={}, formatter='usgscsm', verbose=False):
                traceback.print_exc()
    raise Exception('No Such Driver for Label')

def loads(label, props='', formatter='usgscsm'):
    res = load(label, props, formatter)
def loads(label, props='', formatter='usgscsm', verbose=False):
    res = load(label, props, formatter, verbose=verbose)
    return json.dumps(res, cls=AleJsonEncoder)
+12 −1
Original line number Diff line number Diff line
@@ -50,7 +50,6 @@ class MroCtxIsisLabelIsisSpiceDriver(LineScanner, IsisLabel, IsisSpice, RadialDi
        """
        return "CONTEXT CAMERA"


    @property
    def detector_center_sample(self):
        """
@@ -249,3 +248,15 @@ class MroCtxPds3LabelNaifSpiceDriver(LineScanner, Pds3Label, NaifSpice, RadialDi
          ISIS sensor model version
        """
        return 1

    @property
    def platform_name(self):
        """
        Returns the name of the platform which the instrument is mounted on

        Returns
        -------
        : str
          platform name
        """
        return self.label['SPACECRAFT_NAME']
+8 −2
Original line number Diff line number Diff line
@@ -52,9 +52,12 @@ def compare_dicts(ldict, rdict):
            differences.append(f'Key {key} is present in the left dict, but not the right dict.')
        elif isinstance(item, dict):
            differences.extend(compare_dicts(item, rdict[key]))
        elif isinstance(item, np.ndarray):
        elif isinstance(item, np.ndarray) or isinstance(item, list):
            if not np.allclose(item, rdict[key]):
                differences.append(f'Array values of key {key} are not almost equal {item} : {rdict[key]}.')
        elif isinstance(item, str):
            if item.lower() != rdict[key].lower():
                differences.append(f'Values of key {key} are not equal {item} : {rdict[key]}.')
        else:
            if item != rdict[key]:
                differences.append(f'Values of key {key} are not equal {item} : {rdict[key]}.')
@@ -134,7 +137,10 @@ def convert_kernels(kernels):
    for kernel in kernels:
        split_kernel = os.path.splitext(kernel)
        if 'x' in split_kernel[1].lower():
            bin_output = subprocess.run(['tobin', os.path.join(data_root, kernel)],
            # Get the full path to the kernel then truncate it to the relative path
            path = os.path.join(data_root, kernel)
            path = os.path.relpath(path)
            bin_output = subprocess.run(['tobin', path],
                                        capture_output=True, check=True)
            matches = re.search(r'To: (.*\.b\w*)', str(bin_output.stdout))
            if not matches:
+1227 −0

File added.

Preview size limit exceeded, changes collapsed.

Loading