[Git][debian-gis-team/python-pyproj][master] 2 commits: Add upstream patches to fix test failures.

Bas Couwenberg gitlab at salsa.debian.org
Tue Aug 20 05:08:46 BST 2019



Bas Couwenberg pushed to branch master at Debian GIS Project / python-pyproj


Commits:
f22f2942 by Bas Couwenberg at 2019-08-20T03:56:25Z
Add upstream patches to fix test failures.

- - - - -
17b713f7 by Bas Couwenberg at 2019-08-20T03:56:50Z
Set distribution to experimental.

- - - - -


5 changed files:

- debian/changelog
- + debian/patches/0001-reduce-precision-constrants-on-geodesic-tests-405.patch
- + debian/patches/0001-use-mock-for-changing-os.environ-and-sys.prefix-in-d.patch
- + debian/patches/series
- debian/rules


Changes:

=====================================
debian/changelog
=====================================
@@ -1,8 +1,8 @@
-python-pyproj (2.3.0+ds-1~exp2) UNRELEASED; urgency=medium
+python-pyproj (2.3.0+ds-1~exp2) experimental; urgency=medium
 
-  * Ignore test failures on arm64.
+  * Add upstream patches to fix test failures.
 
- -- Bas Couwenberg <sebastic at debian.org>  Mon, 19 Aug 2019 19:56:29 +0200
+ -- Bas Couwenberg <sebastic at debian.org>  Tue, 20 Aug 2019 05:56:37 +0200
 
 python-pyproj (2.3.0+ds-1~exp1) experimental; urgency=medium
 


=====================================
debian/patches/0001-reduce-precision-constrants-on-geodesic-tests-405.patch
=====================================
@@ -0,0 +1,172 @@
+Description: reduce precision constrants on geodesic tests
+Author: "Alan D. Snow" <alansnow21 at gmail.com>
+Origin: https://github.com/pyproj4/pyproj/commit/2fe0630d399f6647215031b2e07c03448f61947a
+Bug: https://github.com/pyproj4/pyproj/pull/405
+
+--- a/pyproj/geod.py
++++ b/pyproj/geod.py
+@@ -396,8 +396,8 @@ class Geod(_Geod):
+         >>> lons = [-74, -102, -102, -131, -163, 163, 172, 140, 113,
+         ...         88, 59, 25, -4, -14, -33, -46, -61]
+         >>> poly_area, poly_perimeter = geod.polygon_area_perimeter(lons, lats)
+-        >>> "{:.3f} {:.3f}".format(poly_area, poly_perimeter)
+-        '13376856682207.406 14710425.407'
++        >>> "{:.1f} {:.1f}".format(poly_area, poly_perimeter)
++        '13376856682207.4 14710425.4'
+ 
+ 
+         Parameters
+--- a/test/test_geod.py
++++ b/test/test_geod.py
+@@ -183,7 +183,7 @@ def test_geometry_length__linestring():
+     assert_almost_equal(
+         geod.geometry_length(LineString([Point(1, 2), Point(3, 4)])),
+         313588.39721259556,
+-        decimal=3,
++        decimal=2,
+     )
+ 
+ 
+@@ -201,7 +201,7 @@ def test_geometry_length__linestring__ra
+             radians=True,
+         ),
+         313588.39721259556,
+-        decimal=3,
++        decimal=2,
+     )
+ 
+ 
+@@ -213,7 +213,7 @@ def test_geometry_length__linearring():
+             LinearRing(LineString([Point(1, 2), Point(3, 4), Point(5, 2)]))
+         ),
+         1072185.2103813463,
+-        decimal=3,
++        decimal=2,
+     )
+ 
+ 
+@@ -225,7 +225,7 @@ def test_geometry_length__polygon():
+             Polygon(LineString([Point(1, 2), Point(3, 4), Point(5, 2)]))
+         ),
+         1072185.2103813463,
+-        decimal=3,
++        decimal=2,
+     )
+ 
+ 
+@@ -246,7 +246,7 @@ def test_geometry_length__polygon__radia
+             radians=True,
+         ),
+         1072185.2103813463,
+-        decimal=3,
++        decimal=2,
+     )
+ 
+ 
+@@ -257,7 +257,7 @@ def test_geometry_length__multipolygon()
+     assert_almost_equal(
+         geod.geometry_length(MultiPolygon([polygon, polygon])),
+         2 * 1072185.2103813463,
+-        decimal=3,
++        decimal=2,
+     )
+ 
+ 
+@@ -276,7 +276,7 @@ def test_geometry_length__multipolygon__
+     assert_almost_equal(
+         geod.geometry_length(MultiPolygon([polygon, polygon]), radians=True),
+         2 * 1072185.2103813463,
+-        decimal=3,
++        decimal=2,
+     )
+ 
+ 
+@@ -287,7 +287,7 @@ def test_geometry_length__multilinestrin
+     assert_almost_equal(
+         geod.geometry_length(MultiLineString([line_string, line_string])),
+         1254353.5888503822,
+-        decimal=3,
++        decimal=2,
+     )
+ 
+ 
+@@ -311,7 +311,7 @@ def test_geometry_area_perimeter__linest
+     assert_almost_equal(
+         geod.geometry_area_perimeter(LineString([Point(1, 2), Point(3, 4)])),
+         (0.0, 627176.7944251911),
+-        decimal=3,
++        decimal=2,
+     )
+ 
+ 
+@@ -329,7 +329,7 @@ def test_geometry_area_perimeter__linest
+             radians=True,
+         ),
+         (0.0, 627176.7944251911),
+-        decimal=3,
++        decimal=2,
+     )
+ 
+ 
+@@ -341,7 +341,7 @@ def test_geometry_area_perimeter__linear
+             LinearRing(LineString([Point(1, 2), Point(3, 4), Point(5, 2)]))
+         ),
+         (-49187690467.58623, 1072185.2103813463),
+-        decimal=3,
++        decimal=2,
+     )
+ 
+ 
+@@ -353,7 +353,7 @@ def test_geometry_area_perimeter__polygo
+             Polygon(LineString([Point(1, 2), Point(3, 4), Point(5, 2)]))
+         ),
+         (-49187690467.58623, 1072185.2103813463),
+-        decimal=3,
++        decimal=2,
+     )
+ 
+ 
+@@ -374,7 +374,7 @@ def test_geometry_area_perimeter__polygo
+             radians=True,
+         ),
+         (-49187690467.58623, 1072185.2103813463),
+-        decimal=3,
++        decimal=2,
+     )
+ 
+ 
+@@ -389,6 +389,7 @@ def test_geometry_area_perimeter__polygo
+             )
+         ),
+         (-944373881400.3394, 3979008.0359657984),
++        decimal=2,
+     )
+ 
+ 
+@@ -399,7 +400,7 @@ def test_geometry_area_perimeter__multip
+     assert_almost_equal(
+         geod.geometry_area_perimeter(MultiPolygon([polygon, polygon])),
+         (-98375380935.17245, 2144370.4207626926),
+-        decimal=3,
++        decimal=2,
+     )
+ 
+ 
+@@ -418,7 +419,7 @@ def test_geometry_area_perimeter__multip
+     assert_almost_equal(
+         geod.geometry_area_perimeter(MultiPolygon([polygon, polygon]), radians=True),
+         (-98375380935.17245, 2144370.4207626926),
+-        decimal=3,
++        decimal=2,
+     )
+ 
+ 
+@@ -429,7 +430,7 @@ def test_geometry_area_perimeter__multil
+     assert_almost_equal(
+         geod.geometry_area_perimeter(MultiLineString([line_string, line_string])),
+         (-98375380935.17245, 2144370.4207626926),
+-        decimal=3,
++        decimal=2,
+     )
+ 
+ 


=====================================
debian/patches/0001-use-mock-for-changing-os.environ-and-sys.prefix-in-d.patch
=====================================
@@ -0,0 +1,197 @@
+Description: use mock for changing os.environ and sys.prefix in data directory tests
+Author: "Alan D. Snow" <alansnow21 at gmail.com>
+Origin: https://github.com/pyproj4/pyproj/commit/288c149f5306e8b62ee2652bfe0ac5efe555f681
+Bug: https://github.com/pyproj4/pyproj/pull/404
+
+--- a/test/test_datadir.py
++++ b/test/test_datadir.py
+@@ -27,16 +27,9 @@ def proj_env():
+     """
+     Ensure environment variable the same at the end of the test.
+     """
+-    proj_lib = os.environ.get("PROJ_LIB")
+     try:
+         yield
+     finally:
+-        if proj_lib is not None:
+-            # add it back if it used to be there
+-            os.environ["PROJ_LIB"] = proj_lib
+-        else:
+-            # remove it if it wasn't there previously
+-            os.environ.pop("PROJ_LIB", None)
+         # make sure the data dir is cleared
+         set_data_dir(None)
+ 
+@@ -53,72 +46,101 @@ def temporary_directory():
+         shutil.rmtree(temp_dir)
+ 
+ 
+- at unittest.skipIf(os.name == "nt", reason="Cannot modify Windows environment variables.")
++_INVALID_PATH = "/invalid/path/to/nowhere"
++
++
++def setup_os_mock(os_mock, abspath_return=_INVALID_PATH, proj_dir=None):
++    os_mock.path.abspath.return_value = abspath_return
++    os_mock.path.join = os.path.join
++    os_mock.path.dirname = os.path.dirname
++    os_mock.path.exists = os.path.exists
++    os_mock.pathsep = os.pathsep
++    if proj_dir is None:
++        os_mock.environ = {}
++    else:
++        os_mock.environ = {"PROJ_LIB": proj_dir}
++
++
+ def test_get_data_dir__missing():
+     with proj_env(), pytest.raises(DataDirError), patch(
+-        "pyproj.datadir.os.path.abspath", return_value="INVALID"
+-    ), patch("pyproj.datadir.find_executable", return_value=None):
++        "pyproj.datadir.find_executable", return_value=None
++    ), patch("pyproj.datadir.os") as os_mock, patch("pyproj.datadir.sys") as sys_mock:
++        sys_mock.prefix = _INVALID_PATH
++        setup_os_mock(os_mock)
+         unset_data_dir()
+-        os.environ.pop("PROJ_LIB", None)
+         assert get_data_dir() is None
+ 
+ 
+ def test_get_data_dir__from_user():
+-    with proj_env(), temporary_directory() as tmpdir, temporary_directory() as tmpdir_env:  # noqa: E501
++    with proj_env(), temporary_directory() as tmpdir, patch(
++        "pyproj.datadir.os"
++    ) as os_mock, patch(
++        "pyproj.datadir.sys"
++    ) as sys_mock, temporary_directory() as tmpdir_env:  # noqa: E501
++        setup_os_mock(
++            os_mock,
++            abspath_return=os.path.join(tmpdir, "randomfilename.py"),
++            proj_dir=tmpdir_env,
++        )
++        sys_mock.prefix = tmpdir_env
+         create_projdb(tmpdir)
+-        os.environ["PROJ_LIB"] = tmpdir_env
+         create_projdb(tmpdir_env)
+         set_data_dir(tmpdir)
+         internal_proj_dir = os.path.join(tmpdir, "proj_dir", "share", "proj")
+         os.makedirs(internal_proj_dir)
+         create_projdb(internal_proj_dir)
+-        with patch("pyproj.datadir.os.path.abspath") as abspath_mock:
+-            abspath_mock.return_value = os.path.join(tmpdir, "randomfilename.py")
+-            assert get_data_dir() == tmpdir
++        assert get_data_dir() == tmpdir
+ 
+ 
+ def test_get_data_dir__internal():
+-    with proj_env(), temporary_directory() as tmpdir:
++    with proj_env(), temporary_directory() as tmpdir, patch(
++        "pyproj.datadir.os"
++    ) as os_mock, temporary_directory() as tmpdir_fake, patch(
++        "pyproj.datadir.sys"
++    ) as sys_mock:
++        setup_os_mock(
++            os_mock,
++            abspath_return=os.path.join(tmpdir, "randomfilename.py"),
++            proj_dir=tmpdir_fake,
++        )
++        sys_mock.prefix = tmpdir_fake
+         unset_data_dir()
+-        os.environ["PROJ_LIB"] = tmpdir
+         create_projdb(tmpdir)
++        create_projdb(tmpdir_fake)
+         internal_proj_dir = os.path.join(tmpdir, "proj_dir", "share", "proj")
+         os.makedirs(internal_proj_dir)
+         create_projdb(internal_proj_dir)
+-        with patch("pyproj.datadir.os.path.abspath") as abspath_mock:
+-            abspath_mock.return_value = os.path.join(tmpdir, "randomfilename.py")
+-            assert get_data_dir() == internal_proj_dir
++        assert get_data_dir() == internal_proj_dir
+ 
+ 
+- at unittest.skipIf(os.name == "nt", reason="Cannot modify Windows environment variables.")
+ def test_get_data_dir__from_env_var():
+     with proj_env(), temporary_directory() as tmpdir, patch(
+-        "pyproj.datadir.os.path.abspath", return_value="INVALID"
+-    ):
++        "pyproj.datadir.os"
++    ) as os_mock, patch("pyproj.datadir.sys") as sys_mock:
++        setup_os_mock(os_mock, proj_dir=tmpdir)
++        sys_mock.prefix = _INVALID_PATH
+         unset_data_dir()
+-        os.environ["PROJ_LIB"] = tmpdir
+         create_projdb(tmpdir)
+         assert get_data_dir() == tmpdir
+ 
+ 
+- at unittest.skipIf(os.name == "nt", reason="Cannot modify Windows environment variables.")
+ def test_get_data_dir__from_env_var__multiple():
+     with proj_env(), temporary_directory() as tmpdir, patch(
+-        "pyproj.datadir.os.path.abspath", return_value="INVALID"
+-    ):
++        "pyproj.datadir.os"
++    ) as os_mock, patch("pyproj.datadir.sys") as sys_mock:
++        setup_os_mock(os_mock, proj_dir=os.pathsep.join([tmpdir, tmpdir, tmpdir]))
++        sys_mock.prefix = _INVALID_PATH
+         unset_data_dir()
+-        os.environ["PROJ_LIB"] = os.pathsep.join([tmpdir, tmpdir, tmpdir])
+         create_projdb(tmpdir)
+         assert get_data_dir() == os.pathsep.join([tmpdir, tmpdir, tmpdir])
+ 
+ 
+- at unittest.skipIf(os.name == "nt", reason="Cannot modify Windows environment variables.")
+ def test_get_data_dir__from_prefix():
+     with proj_env(), temporary_directory() as tmpdir, patch(
+-        "pyproj.datadir.os.path.abspath", return_value="INVALID"
+-    ), patch("pyproj.datadir.sys") as sys_mock:
++        "pyproj.datadir.os"
++    ) as os_mock, patch("pyproj.datadir.sys") as sys_mock:
++        setup_os_mock(os_mock)
+         unset_data_dir()
+-        os.environ.pop("PROJ_LIB", None)
+         sys_mock.prefix = tmpdir
+         proj_dir = os.path.join(tmpdir, "share", "proj")
+         os.makedirs(proj_dir)
+@@ -126,13 +148,15 @@ def test_get_data_dir__from_prefix():
+         assert get_data_dir() == proj_dir
+ 
+ 
+- at unittest.skipIf(os.name == "nt", reason="Cannot modify Windows environment variables.")
+ def test_get_data_dir__from_path():
+     with proj_env(), temporary_directory() as tmpdir, patch(
+-        "pyproj.datadir.os.path.abspath", return_value="INVALID"
+-    ), patch("pyproj.datadir.find_executable") as find_exe:
++        "pyproj.datadir.os"
++    ) as os_mock, patch("pyproj.datadir.sys") as sys_mock, patch(
++        "pyproj.datadir.find_executable"
++    ) as find_exe:
++        setup_os_mock(os_mock)
++        sys_mock.prefix = _INVALID_PATH
+         unset_data_dir()
+-        os.environ.pop("PROJ_LIB", None)
+         find_exe.return_value = os.path.join(tmpdir, "bin", "proj")
+         proj_dir = os.path.join(tmpdir, "share", "proj")
+         os.makedirs(proj_dir)
+@@ -141,18 +165,18 @@ def test_get_data_dir__from_path():
+ 
+ 
+ def test_append_data_dir__internal():
+-    with proj_env(), temporary_directory() as tmpdir:
++    with proj_env(), temporary_directory() as tmpdir, patch(
++        "pyproj.datadir.os"
++    ) as os_mock:
++        setup_os_mock(os_mock, os.path.join(tmpdir, "randomfilename.py"))
+         unset_data_dir()
+-        os.environ["PROJ_LIB"] = tmpdir
+         create_projdb(tmpdir)
+         internal_proj_dir = os.path.join(tmpdir, "proj_dir", "share", "proj")
+         os.makedirs(internal_proj_dir)
+         create_projdb(internal_proj_dir)
+         extra_datadir = str(os.path.join(tmpdir, "extra_datumgrids"))
+-        with patch("pyproj.datadir.os.path.abspath") as abspath_mock:
+-            abspath_mock.return_value = os.path.join(tmpdir, "randomfilename.py")
+-            append_data_dir(extra_datadir)
+-            assert get_data_dir() == os.pathsep.join([internal_proj_dir, extra_datadir])
++        append_data_dir(extra_datadir)
++        assert get_data_dir() == os.pathsep.join([internal_proj_dir, extra_datadir])
+ 
+ 
+ def test_creating_multiple_crs_without_file_limit():


=====================================
debian/patches/series
=====================================
@@ -0,0 +1,2 @@
+0001-use-mock-for-changing-os.environ-and-sys.prefix-in-d.patch
+0001-reduce-precision-constrants-on-geodesic-tests-405.patch


=====================================
debian/rules
=====================================
@@ -9,7 +9,7 @@ export DEB_BUILD_MAINT_OPTIONS=hardening=+all
 
 export PYBUILD_NAME=pyproj
 export PYBUILD_TEST_PYTEST=1
-export PYBUILD_TEST_ARGS=-v --ignore=test/test_datadir.py
+export PYBUILD_TEST_ARGS=-v
 
 # Path to system installed PROJ data.
 export PROJ_DIR=/usr
@@ -25,7 +25,7 @@ include /usr/share/dpkg/architecture.mk
 
 override_dh_auto_test:
 ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
-ifneq (,$(filter $(DEB_BUILD_ARCH),arm64 armhf i386 hppa hurd-i386 kfreebsd-i386 powerpc))
+ifneq (,$(filter $(DEB_BUILD_ARCH),i386 hppa hurd-i386 kfreebsd-i386 powerpc))
 	dh_auto_test || echo "Ignoring test failures"
 else
 	dh_auto_test



View it on GitLab: https://salsa.debian.org/debian-gis-team/python-pyproj/compare/b8773b1bd50a3f0947d12e5d19aae1416a6aaa04...17b713f7830920a0b96426da2195e0f41018238c

-- 
View it on GitLab: https://salsa.debian.org/debian-gis-team/python-pyproj/compare/b8773b1bd50a3f0947d12e5d19aae1416a6aaa04...17b713f7830920a0b96426da2195e0f41018238c
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20190820/39b3d162/attachment-0001.html>


More information about the Pkg-grass-devel mailing list