Skip to content

Commit

Permalink
fix: update tests that depend on server to skip in case server is una…
Browse files Browse the repository at this point in the history
…vailable
  • Loading branch information
AngRodrigues committed May 31, 2024
1 parent b2c6638 commit 646be9e
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 28 deletions.
28 changes: 18 additions & 10 deletions tests/project/test_plot_hamersley.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import pytest
#internal imports
from map2loop.project import Project
from map2loop.m2l_enums import VerboseLevel

#external imports
import pytest
from pyproj.exceptions import CRSError
import os
import requests

bbox_3d = {
"minx": 515687.31005864,
Expand All @@ -23,15 +27,19 @@ def remove_LPF():


def test_project_execution():
proj = Project(
use_australian_state_data="WA",
working_projection="EPSG:28350",
bounding_box=bbox_3d,
clut_file_legacy=False,
verbose_level=VerboseLevel.NONE,
loop_project_filename=loop_project_filename,
overwrite_loopprojectfile=True,
)
try:
proj = Project(
use_australian_state_data="WA",
working_projection="EPSG:28350",
bounding_box=bbox_3d,
clut_file_legacy=False,
verbose_level=VerboseLevel.NONE,
loop_project_filename=loop_project_filename,
overwrite_loopprojectfile=True,
)
except requests.exceptions.ReadTimeout:
pytest.skip("Connection to the server timed out, skipping test")

proj.run_all(take_best=True)
assert proj is not None, "Plot Hamersley Basin failed to execute"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
#internal imports
from map2loop.thickness_calculator import StructuralPoint
from map2loop.project import Project
from map2loop.m2l_enums import VerboseLevel
import pathlib

#external imports
import pathlib
import pytest
import requests
import map2loop


Expand All @@ -19,23 +23,26 @@ def test_from_aus_state():
loop_project_filename = "wa_output.loop3d"
module_path = map2loop.__file__.replace("__init__.py", "")

proj = Project(
use_australian_state_data="WA",
working_projection="EPSG:28350",
bounding_box=bbox_3d,
config_filename=pathlib.Path(module_path)
/ pathlib.Path('_datasets')
/ pathlib.Path('config_files')
/ pathlib.Path('WA.json'),
clut_filename=pathlib.Path(module_path)
/ pathlib.Path('_datasets')
/ pathlib.Path('clut_files')
/ pathlib.Path('WA_clut.csv'),
# clut_file_legacy=False,
verbose_level=VerboseLevel.NONE,
loop_project_filename=loop_project_filename,
overwrite_loopprojectfile=True,
)
try:
proj = Project(
use_australian_state_data="WA",
working_projection="EPSG:28350",
bounding_box=bbox_3d,
config_filename=pathlib.Path(module_path)
/ pathlib.Path('_datasets')
/ pathlib.Path('config_files')
/ pathlib.Path('WA.json'),
clut_filename=pathlib.Path(module_path)
/ pathlib.Path('_datasets')
/ pathlib.Path('clut_files')
/ pathlib.Path('WA_clut.csv'),
# clut_file_legacy=False,
verbose_level=VerboseLevel.NONE,
loop_project_filename=loop_project_filename,
overwrite_loopprojectfile=True,
)
except requests.exceptions.ReadTimeout:
pytest.skip("Connection to the server timed out, skipping test")

proj.set_thickness_calculator(StructuralPoint())
proj.run_all()
Expand Down

0 comments on commit 646be9e

Please sign in to comment.