diff --git a/.github/workflows/cicd_light.yml b/.github/workflows/cicd_light.yml index 340173c..b641cae 100644 --- a/.github/workflows/cicd_light.yml +++ b/.github/workflows/cicd_light.yml @@ -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" diff --git a/CHANGELOG.md b/CHANGELOG.md index c6ff95b..ec26db4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/Makefile b/Makefile index ef48d6f..535b9db 100644 --- a/Makefile +++ b/Makefile @@ -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: diff --git a/pdaltools/_version.py b/pdaltools/_version.py index b75bb55..ecb2274 100644 --- a/pdaltools/_version.py +++ b/pdaltools/_version.py @@ -1,4 +1,4 @@ -__version__ = "1.1.0" +__version__ = "1.1.1" if __name__ == "__main__": diff --git a/pdaltools/unlock_file.py b/pdaltools/unlock_file.py index 7fcc0b2..d2f0625 100644 --- a/pdaltools/unlock_file.py +++ b/pdaltools/unlock_file.py @@ -57,6 +57,8 @@ def parse_args(): required=True, help="Input file") + return parser.parse_args() + if __name__ == "__main__": args = parse_args() diff --git a/pyproject.toml b/pyproject.toml index 0afaa72..428bd7b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,13 @@ readme = "README.md" authors = [ { name = "Guillaume Liegard", email = "guillaume.liegard@ign.fr" } ] + [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", +] diff --git a/test/test_color.py b/test/test_color.py index 3fc6cd0..361478a 100644 --- a/test/test_color.py +++ b/test/test_color.py @@ -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) @@ -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): @@ -84,5 +88,3 @@ def raise_server_error(): with pytest.raises(requests.exceptions.HTTPError): raise_server_error() - - diff --git a/test/test_standardize_format.py b/test/test_standardize_format.py index ac496cc..b795a9a 100644 --- a/test/test_standardize_format.py +++ b/test/test_standardize_format.py @@ -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) diff --git a/test/test_unlock.py b/test/test_unlock.py index 8bcd64c..5b48c62 100644 --- a/test/test_unlock.py +++ b/test/test_unlock.py @@ -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__)) @@ -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")