Skip to content

Commit

Permalink
resolving unit test hanging on problem
Browse files Browse the repository at this point in the history
  • Loading branch information
duncanBotti committed Jul 9, 2024
1 parent 2b35149 commit 6c65d05
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/aws/osml/model_runner/tile_worker/tile_worker_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def process_tiles(
"""

tile_array = generate_crops(
region_request.region_bounds, # type: ignore[arg-type]
region_request.region_bounds,
region_request.tile_size,
region_request.tile_overlap,
)
Expand Down
11 changes: 5 additions & 6 deletions test/aws/osml/model_runner/tile_worker/test_tile_worker_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,21 +63,17 @@ def test_setup_tile_workers_exception(self, mock_service_config, mock_tile_worke
# with self.assertRaises(ValueError):
setup_tile_workers(mock_region_request, mock_sensor_model, mock_elevation_model)

@patch("aws.osml.model_runner.tile_worker.tile_worker_utils.ServiceConfig", autospec=True)
def test_process_tiles(
self,
mock_service_config,
):
from aws.osml.gdal.gdal_utils import load_gdal_dataset
from aws.osml.model_runner.api import RegionRequest
from aws.osml.model_runner.tile_worker.tile_worker_utils import process_tiles, setup_tile_workers

mock_num_tile_workers = 4
mock_service_config.workers = mock_num_tile_workers
mock_region_request = RegionRequest(
{
"tile_size": (10, 10),
"tile_overlap": (1, 1),
"tile_overlap": (0, 0),
"tile_format": "NITF",
"image_id": "1",
"image_url": "/mock/path",
Expand All @@ -91,14 +87,17 @@ def test_process_tiles(
mock_elevation_model = None
work_queue, tile_worker_list = setup_tile_workers(mock_region_request, sensor_model, mock_elevation_model)

assert 25, 0 == process_tiles(
completed_tiles, failed_tiles = process_tiles(
region_request=mock_region_request,
tile_queue=work_queue,
tile_workers=tile_worker_list,
raster_dataset=ds,
sensor_model=sensor_model,
)

assert completed_tiles == 25
assert failed_tiles == 0

def test_chip_generator(self):
from aws.osml.model_runner.tile_worker.tile_worker_utils import generate_crops

Expand Down

0 comments on commit 6c65d05

Please sign in to comment.