Skip to content

Commit

Permalink
Merge pull request #13 from IGNF/dev
Browse files Browse the repository at this point in the history
dev to master version 1.1.1
  • Loading branch information
gliegard authored Jul 28, 2023
2 parents c716af0 + 5952421 commit 226c378
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cicd_light.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ jobs:

- name: Run tests with pytest
shell: micromamba-shell {0}
run: python -m pytest ./test -s --log-cli-level DEBUG
run: python -m pytest ./test -s --log-cli-level DEBUG -m "not geoportail"

8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
# dev

# 1.1.1
- unlock: fix main
- tests:
- add geoportail marker to skip tests relying on geoportail (they are now played on PR to the master branch only)
- bugfix on standardization test file path

# 1.1.0
standardization: handle malformed laz input ("Global encoding WKT flag not set for point format 6 - 10")
- standardization: handle malformed laz input ("Global encoding WKT flag not set for point format 6 - 10")
color: extract unlock module from colorization and rename colorization function

# 1.0.0
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ install:
pip install -e .

testing:
python -m pytest ./test -s --log-cli-level DEBUG -m "not geoportail"

testing_full:
python -m pytest ./test -s --log-cli-level DEBUG

clean:
Expand Down
2 changes: 1 addition & 1 deletion pdaltools/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "1.1.0"
__version__ = "1.1.1"


if __name__ == "__main__":
Expand Down
2 changes: 2 additions & 0 deletions pdaltools/unlock_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ def parse_args():
required=True,
help="Input file")

return parser.parse_args()


if __name__ == "__main__":
args = parse_args()
Expand Down
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@ readme = "README.md"
authors = [
{ name = "Guillaume Liegard", email = "[email protected]" }
]

[tool.setuptools.dynamic]
version = {attr = "pdaltools._version.__version__"}
[tool.setuptools]
packages = [ "pdaltools" ]

[tool.pytest.ini_options]
markers = [
"geoportail: marks tests that request the (sometimes unreliable) geoportail.gouv.fr",
]
6 changes: 4 additions & 2 deletions test/test_color.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def setup_module(module):
OUTPUT_FILE = TMPDIR + "Semis_2021_0435_6292_LA93_IGN69.las"


@pytest.mark.geoportail
def test_epsg_fail():
with pytest.raises(requests.exceptions.HTTPError, match="400 Client Error: BadRequest for url") :
color.color(INPUT_PATH, OUTPUT_FILE, "", 0.1, 15)
Expand All @@ -38,16 +39,19 @@ def test_epsg_fail():
pixel_per_meter=0.1


@pytest.mark.geoportail
def test_download_image_ok():
color.download_image_from_geoportail(epsg, layer, minx, miny, maxx, maxy, pixel_per_meter, OUTPUT_FILE, 15)


@pytest.mark.geoportail
def test_download_image_raise1():
retry_download = color.retry(2, 5)(color.download_image_from_geoportail)
with pytest.raises(requests.exceptions.HTTPError):
retry_download(epsg, "MAUVAISE_COUCHE", minx, miny, maxx, maxy, pixel_per_meter, OUTPUT_FILE, 15)


@pytest.mark.geoportail
def test_download_image_raise2():
retry_download = color.retry(2, 5)(color.download_image_from_geoportail)
with pytest.raises(requests.exceptions.HTTPError):
Expand Down Expand Up @@ -84,5 +88,3 @@ def raise_server_error():

with pytest.raises(requests.exceptions.HTTPError):
raise_server_error()


4 changes: 2 additions & 2 deletions test/test_standardize_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ def test_standardize_does_NOT_produce_any_warning_with_Lasinfo():
# bad file on the store (44 Mo)
# input_file = "/var/data/store-lidarhd/developpement/standaLAS/demo_standardization/Semis_2022_0584_6880_LA93_IGN69.laz"

input_file = "./test/data/classified_laz/test_data_77050_627755_LA93_IGN69.laz"
output_file = "./tmp/test_standardize_produce_no_warning_with_lasinfo.las"
input_file = os.path.join(test_path, "data/classified_laz/test_data_77050_627755_LA93_IGN69.laz")
output_file = os.path.join(tmp_path, "test_standardize_produce_no_warning_with_lasinfo.las")

# if you want to see input_file warnings
# assert_lasinfo_no_warning(input_file)
Expand Down
18 changes: 15 additions & 3 deletions test/test_unlock.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import laspy
import os
import shutil
import pdal
import pytest

from pdaltools.color import color, pdal_info_json
from pdaltools.unlock_file import unlock_file
from pdaltools.unlock_file import unlock_file, copy_and_hack_decorator


TEST_PATH = os.path.dirname(os.path.abspath(__file__))
Expand All @@ -20,7 +20,19 @@ def setup_module(module):
os.mkdir(TMPDIR)


def test_copy_and_hack_decorator():
@copy_and_hack_decorator
def decorated_pdal_info_json(input_file: str):
return pdal_info_json(input_file)


def test_copy_and_hack_decorator_simple():
TMP_FILE = os.path.join(TMPDIR, "copy_and_hack_simple.laz")
shutil.copy(LAZ_FILE, TMP_FILE)
decorated_pdal_info_json(TMP_FILE)


@pytest.mark.geoportail
def test_copy_and_hack_decorator_color():
# bug during laz opening in pdal (solved with copy_and_hack_decorator)
LAS_FILE = os.path.join(TMPDIR, "test_pdalfail_0643_6319_LA93_IGN69.las")

Expand Down

0 comments on commit 226c378

Please sign in to comment.