|
8 | 8 | import unittest.mock as mock |
9 | 9 | from typing import List, Union |
10 | 10 |
|
| 11 | +import pyproj |
11 | 12 | import pytest |
12 | 13 | import shapely.geometry |
13 | 14 |
|
| 15 | +from openeo.capabilities import ComparableVersion |
14 | 16 | from openeo.util import ( |
15 | 17 | BBoxDict, |
16 | 18 | ContextTimer, |
@@ -891,6 +893,10 @@ class TestNormalizeCrs: |
891 | 893 | ) |
892 | 894 | def test_normalize_crs_succeeds_with_correct_crses(self, epsg_input, expected): |
893 | 895 | """Happy path, values that are allowed""" |
| 896 | + if isinstance(epsg_input, str) and epsg_input.isnumeric() and pyproj.__version__ < ComparableVersion("3.3.1"): |
| 897 | + # TODO #460 this skip is only necessary for python 3.6 and lower |
| 898 | + pytest.skip("pyproj below 3.3.1 does not support int-like strings") |
| 899 | + |
894 | 900 | assert normalize_crs(epsg_input) == expected |
895 | 901 |
|
896 | 902 | @pytest.mark.parametrize( |
@@ -926,23 +932,22 @@ def test_normalize_crs_without_pyproj_accept_non_epsg_string(self, caplog): |
926 | 932 | in caplog.text |
927 | 933 | ) |
928 | 934 |
|
929 | | - @pytest.mark.skipif(sys.version_info < (3, 7), reason="WKT2 format not supported by pyproj 3.0 / python 3.6") |
| 935 | + @pytest.mark.skipif( |
| 936 | + # TODO #460 this skip is only necessary for python 3.6 and lower |
| 937 | + pyproj.__version__ < ComparableVersion("3.1.0"), |
| 938 | + reason="WKT2 format support requires pypro 3.1.0 or higher", |
| 939 | + ) |
930 | 940 | def test_normalize_crs_succeeds_with_wkt2_input(self): |
931 | 941 | """Test can handle WKT2 strings. |
932 | 942 |
|
933 | 943 | We need to support WKT2: |
934 | 944 | See also https://github.com/Open-EO/openeo-processes/issues/58 |
935 | | -
|
936 | | -
|
937 | | - WARNING: |
938 | | - ======= |
939 | | -
|
940 | | - Older versions of pyproj do not support this format. |
941 | | - In particular, pyproj 3.0 which is the version we get on python 3.6, would |
942 | | - fail on this test, and is marked with a skipif for that reason. |
943 | 945 | """ |
944 | 946 | assert normalize_crs(self.WKT2_FOR_EPSG32631) == 32631 |
945 | 947 |
|
| 948 | + def test_normalize_crs_without_pyproj_succeeds_with_wkt2_input(self): |
| 949 | + assert normalize_crs(self.WKT2_FOR_EPSG32631, use_pyproj=False) == self.WKT2_FOR_EPSG32631 |
| 950 | + |
946 | 951 | PROJJSON_FOR_EPSG32631 = { |
947 | 952 | "$schema": "https://proj.org/schemas/v0.4/projjson.schema.json", |
948 | 953 | "type": "ProjectedCRS", |
@@ -1013,7 +1018,9 @@ def test_normalize_crs_succeeds_with_wkt2_input(self): |
1013 | 1018 | } |
1014 | 1019 |
|
1015 | 1020 | @pytest.mark.skipif( |
1016 | | - sys.version_info < (3, 8), reason="PROJJSON format not supported by pyproj v3.2 / python < v3.8" |
| 1021 | + # TODO #460 this skip is only necessary for python 3.6 and lower |
| 1022 | + pyproj.__version__ < ComparableVersion("3.3.0"), |
| 1023 | + reason="PROJJSON format requires pyproj 3.3.0 or higher", |
1017 | 1024 | ) |
1018 | 1025 | def test_normalize_crs_succeeds_with_correct_projjson( |
1019 | 1026 | self, |
|
0 commit comments