Skip to content

Commit

Permalink
Move testing of layer writing into resources folder
Browse files Browse the repository at this point in the history
  • Loading branch information
kcartier-wri committed Aug 14, 2024
1 parent 0d026e3 commit bc996c3
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
Empty file added tests/resources/__init__.py
Empty file.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@
UrbanLandUse,
WorldPop
)
from tests.fixtures.bbox_constants import *
from tools.general_tools import create_temp_folder, verify_file_is_populated
from tests.resources.bbox_constants import BBOX_BR_LAURO_DE_FREITAS_1
from tools.general_tools import create_temp_folder

RUN_DUMPS = False
RUN_DUMPS = True
BBOX = BBOX_BR_LAURO_DE_FREITAS_1

@pytest.mark.skipif(RUN_DUMPS == False, reason='Skipping since RUN_DUMPS set to False')
def test_prepare_target():
def test_geotiff_writing():
qgis_project_file = 'layers_for_br_lauro_de_freitas.qgs'

source_folder = os.path.join(os.path.dirname(__file__), 'resources')
source_folder = os.path.dirname(__file__)
output_temp_folder = create_temp_folder('test_result_tif_files')
source_qgis_file = os.path.join(source_folder, qgis_project_file)
target_qgis_file = os.path.join(output_temp_folder, qgis_project_file)
Expand Down Expand Up @@ -163,3 +163,7 @@ def prep_output_path(output_temp_folder, file_name):
if os.path.isfile(file_path):
os.remove(file_path)
return file_path

def verify_file_is_populated(file_path):
is_populated = True if os.path.getsize(file_path) > 0 else False
return is_populated
2 changes: 1 addition & 1 deletion tests/test_layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
WorldPop
)
from city_metrix.layers.layer import get_image_collection
from tests.fixtures.bbox_constants import BBOX_BR_LAURO_DE_FREITAS_1
from tests.resources.bbox_constants import BBOX_BR_LAURO_DE_FREITAS_1

EE_IMAGE_DIMENSION_TOLERANCE = 1 # Tolerance compensates for variable results from GEE service

Expand Down
3 changes: 0 additions & 3 deletions tools/general_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,3 @@ def create_temp_folder(sub_directory):

return path

def verify_file_is_populated(file_path):
is_populated = True if os.path.getsize(file_path) > 0 else False
return is_populated

0 comments on commit bc996c3

Please sign in to comment.