question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Tests failing on Alpine Linux

See original GitHub issue

Hi, I am trying to compile the pyproj library on Alpine Linux. I filed a few bug fixes with the proj project (and musl libc) that were all fixed enabling the proj library to compile and pass tests on Alpine Linux 32/64b on a number of architectures. I am not having similar luck with pyproj though.

Problem description

Please see the attached build and test log, there are a number of failures:

job.log

Failures

=================================== FAILURES ===================================
_______________________________ test_datum[Proj] _______________________________

proj_class = <class 'pyproj.proj.Proj'>, aoi_data_directory = None

    @pytest.mark.parametrize("proj_class", [Proj, CRS])
    def test_datum(proj_class, aoi_data_directory):
        p1 = proj_class(proj="latlong", datum="WGS84")
        s_1 = -111.5
        s_2 = 45.25919444444
        p2 = proj_class(proj="utm", zone=10, datum="NAD27")
        x2, y2 = transform(p1, p2, s_1, s_2)
        if LooseVersion(proj_version_str) < LooseVersion("6.3.0"):
            assert_almost_equal((x2, y2), (1402291.0833290431, 5076289.591846835))
        else:
            # https://github.com/OSGeo/PROJ/issues/1808
>           assert_almost_equal((x2, y2), (1402285.9829252, 5076292.4212746))
E           AssertionError: 
E           Arrays are not almost equal to 7 decimals
E           
E           Mismatched elements: 2 / 2 (100%)
E           Max absolute difference: 4.21450818
E           Max relative difference: 1.82410064e-06
E            x: array([1402288.540836 , 5076296.6357828])
E            y: array([1402285.9829252, 5076292.4212746])

test/test_datum.py:20: AssertionError
_______________________________ test_datum[CRS] ________________________________

proj_class = <class 'pyproj.crs.crs.CRS'>, aoi_data_directory = None

    @pytest.mark.parametrize("proj_class", [Proj, CRS])
    def test_datum(proj_class, aoi_data_directory):
        p1 = proj_class(proj="latlong", datum="WGS84")
        s_1 = -111.5
        s_2 = 45.25919444444
        p2 = proj_class(proj="utm", zone=10, datum="NAD27")
        x2, y2 = transform(p1, p2, s_1, s_2)
        if LooseVersion(proj_version_str) < LooseVersion("6.3.0"):
            assert_almost_equal((x2, y2), (1402291.0833290431, 5076289.591846835))
        else:
            # https://github.com/OSGeo/PROJ/issues/1808
>           assert_almost_equal((x2, y2), (1402285.9829252, 5076292.4212746))
E           AssertionError: 
E           Arrays are not almost equal to 7 decimals
E           
E           Mismatched elements: 2 / 2 (100%)
E           Max absolute difference: 4.21450818
E           Max relative difference: 1.82410064e-06
E            x: array([1402288.540836 , 5076296.6357828])
E            y: array([1402285.9829252, 5076292.4212746])

test/test_datum.py:20: AssertionError
________________________________ test_doctests _________________________________

aoi_data_directory = None

    def test_doctests(aoi_data_directory):
        """run the examples in the docstrings using the doctest module"""
    
        with warnings.catch_warnings():
            warnings.filterwarnings(
                "ignore",
                "You will likely lose important projection information when",
                UserWarning,
            )
    
            failure_count_proj, test_count = doctest.testmod(pyproj.proj, verbose=True)
            failure_count_crs, test_count_crs = doctest.testmod(pyproj.crs, verbose=True)
            failure_count_geod, test_count_geod = doctest.testmod(pyproj.geod, verbose=True)
            failure_count_transform, test_count_transform = doctest.testmod(
                pyproj.transformer, verbose=True
            )
    
        failure_count = (
            failure_count_proj
            + failure_count_crs
            + failure_count_geod
            + failure_count_transform
        )
        # Missing shapely wheels for Windows, non x86_64 platforms, and python 3.8
        expected_failure_count = 0
        try:
            import shapely  # noqa
        except ImportError:
            if (
                os.name == "nt"
                or platform.uname()[4] != "x86_64"
                or (sys.version_info.major, sys.version_info.minor) >= (3, 8)
            ):
                expected_failure_count = 6
    
        # if the below line fails, doctests have failed
>       assert (
            failure_count == expected_failure_count
        ), "{0} of the doctests in " "lib/pyproj/__init__.py failed".format(failure_count)
E       AssertionError: 9 of the doctests in lib/pyproj/__init__.py failed
E       assert 9 == 6

test/test_doctest_wrapper.py:50: AssertionError
2 items had failures:
   3 of   5 in pyproj.geod.Geod.geometry_area_perimeter
   3 of   5 in pyproj.geod.Geod.geometry_length
2 items had failures:
   1 of   3 in pyproj.transformer.TransformerGroup.__init__
   2 of  19 in pyproj.transformer.transform
FAILED test/test_datum.py::test_datum[Proj] - AssertionError: 
FAILED test/test_datum.py::test_datum[CRS] - AssertionError: 
FAILED test/test_doctest_wrapper.py::test_doctests - AssertionError: 9 of the...
FAILED test/test_transformer.py::test_transform_wgs84_to_alaska - AssertionEr...
FAILED test/test_transformer.py::test_repr - AssertionError: assert '<Concate...
FAILED test/test_transformer.py::test_transformer_group__unavailable - assert...
FAILED test/test_transformer.py::test_transform_group__missing_best - assert ...
FAILED test/crs/test_crs.py::test_coordinate_operation_grids__alternative_grid_name

Expected Output

All tests passing =)

Environment Information

Shown in build log. Errors also occur on other architectures.

(9/39) Installing python3 (3.8.2-r0)
(17/39) Installing proj-datumgrid (7.0.0-r0)
(20/39) Installing proj (7.0.0-r0)
(21/39) Installing proj-dev (7.0.0-r0)

Installation method

From source

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
russkelcommented, Mar 27, 2020

Tests pass fine once I fixed the proj-datumgrid package. Sorry for wasting your time @snowman2 and thanks for your help!

pyproj should be merged into alpine edge soon.

0reactions
russkelcommented, Mar 27, 2020

Yes, I have had issues with missing grids using cmake in the past.

Right. I will look into it. I thought CMake would have been the more relevant one to use 🤦‍♂️

Read more comments on GitHub >

github_iconTop Results From Across the Web

failing tests on alpine linux #798 - xtensor-stack/xsimd - GitHub
I am trying to package for alpine linux and 2 tests are failing: xsimd-8.1.0/test/test_complex_trigonometric.cpp:160: Failure ...
Read more >
CMake test suite failing on Alpine Linux - Development
There are 3 tests failing in the CMake test suite when building from sources on Alpine Linux. I tried to crawl the CMake...
Read more >
community/chromium: upgrade to 99.0.4844.82, reenable tests
Tests look like they might just be broken. Upstream introduced a meson build system about a year ago an all tests pass when...
Read more >
Failing test on Alpine Linux (#171) · Issues - Freedesktop GitLab
No tasks are currently assigned. Use tasks to break down this issue into smaller parts. Linked items. 0.
Read more >
Issue 46390: Multiple test failures on Alpine 3.15 / musl-1.2.2-r7
It is reasonable to assume that failing test are caused by incompatibilities or deficiencies in musl libc, or by a different interpretation of ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found