Skip to content

Commit

Permalink
add test_cli with initial 'oty ortho' tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dugalh committed Oct 6, 2023
1 parent 06a3cca commit c69bff6
Show file tree
Hide file tree
Showing 4 changed files with 600 additions and 1 deletion.
24 changes: 24 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import yaml
import numpy as np
import pytest
from click.testing import CliRunner
import rasterio as rio
from rasterio.transform import from_origin, from_bounds
from rasterio.warp import transform_bounds, transform
Expand Down Expand Up @@ -144,6 +145,12 @@ def oty_to_osfm_int_param(int_param_dict: Dict) -> Dict:
return osfm_dict


@pytest.fixture(scope='session')
def runner():
""" click runner for command line execution. """
return CliRunner()


@pytest.fixture(scope='session')
def xyz() -> Tuple[float, float, float]:
""" Example camera (easting, northing, altitude) position (m). """
Expand Down Expand Up @@ -518,6 +525,7 @@ def odm_dem_file(odm_proj_dir: Path) -> Path:
def osfm_reconstruction_file(odm_proj_dir: Path) -> Path:
""" ODM / OpenSfM reconstruction file. """
return odm_proj_dir.joinpath('opensfm', 'reconstruction.json')
# TODO: there is a confusion between odm_* fixtures referring to odm format or odm dataset


@pytest.fixture(scope='session')
Expand All @@ -540,6 +548,12 @@ def ngi_image_file() -> Path:
return next(iter(root_path.joinpath('tests', 'data', 'ngi').glob('*RGB.tif')))


@pytest.fixture(scope='session')
def ngi_image_wildcard() -> str:
""" Wildcard for NGI aerial image files. """
return str(root_path.joinpath('tests', 'data', 'ngi')) + '*RGB.tif'


@pytest.fixture(scope='session')
def ngi_dem_file() -> Path:
""" NGI DEM file. """
Expand Down Expand Up @@ -572,6 +586,7 @@ def ngi_legacy_csv_file() -> Path:
return root_path.joinpath('tests', 'data', 'ngi', 'camera_pos_ori.txt')


# TODO: create io fixtures dynamically?
@pytest.fixture(scope='session')
def ngi_oty_ext_param_file() -> Path:
""" Orthority format exterior parameter file for NGI test data. """
Expand Down Expand Up @@ -602,4 +617,13 @@ def odm_lla_rpy_csv_file() -> Path:
return root_path.joinpath('tests', 'data', 'io', 'odm_lla_rpy.csv')


@pytest.fixture(scope='session')
def odm_xyz_opk_csv_file() -> Path:
"""
Exterior parameters for ODM data in (easting, northing, altitude), (omega, phi, kappa) CSV format. Includes
a header.
"""
return root_path.joinpath('tests', 'data', 'io', 'odm_xyz_opk.csv')


# TODO: move fixtures used by a single module to that module
Loading

0 comments on commit c69bff6

Please sign in to comment.