Toblerity / rtree

Rtree: spatial index for Python GIS
https://rtree.readthedocs.io
MIT License
627 stars 123 forks source link

Test failures with libspatialindex 2.0.0 #312

Closed sebastic closed 5 months ago

sebastic commented 5 months ago

The Debian package build fails due to test failures when using spatialindex 2.0.0 from experimental:

I: pybuild base:311: cd /build/python-rtree-1.2.0/.pybuild/cpython3_3.12_rtree/build; python3.12 -m pytest tests
============================= test session starts ==============================
platform linux -- Python 3.12.3, pytest-8.2.1, pluggy-1.5.0
rootdir: /build/python-rtree-1.2.0/.pybuild/cpython3_3.12_rtree/build
configfile: pyproject.toml
collected 40 items

tests/test_finder.py ..                                                  [  5%]
tests/test_index.py F.......x...........Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
.................                [ 97%]
tests/test_tpr.py .                                                      [100%]

=================================== FAILURES ===================================
______________________ IndexVersion.test_libsidx_version _______________________

self = <tests.test_index.IndexVersion testMethod=test_libsidx_version>

    def test_libsidx_version(self) -> None:
>       self.assertTrue(index.major_version == 1)
E       AssertionError: False is not true

/build/python-rtree-1.2.0/.pybuild/cpython3_3.12_rtree/build/tests/test_index.py:47: AssertionError
=========================== short test summary info ============================
FAILED tests/test_index.py::IndexVersion::test_libsidx_version - AssertionErr...
=================== 1 failed, 38 passed, 1 xfailed in 0.30s ====================
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
E: pybuild pybuild:389: test: plugin pyproject failed with: exit code=1: cd /build/python-rtree-1.2.0/.pybuild/cpython3_3.12_rtree/build; python3.12 -m pytest tests
I: pybuild base:311: cd /build/python-rtree-1.2.0/.pybuild/cpython3_3.11_rtree/build; python3.11 -m pytest tests
============================= test session starts ==============================
platform linux -- Python 3.11.9, pytest-8.2.1, pluggy-1.5.0
rootdir: /build/python-rtree-1.2.0/.pybuild/cpython3_3.11_rtree/build
configfile: pyproject.toml
collected 40 items

tests/test_finder.py ..                                                  [  5%]
tests/test_index.py F.......x...........Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
.................                [ 97%]
tests/test_tpr.py .                                                      [100%]

=================================== FAILURES ===================================
______________________ IndexVersion.test_libsidx_version _______________________

self = <tests.test_index.IndexVersion testMethod=test_libsidx_version>

    def test_libsidx_version(self) -> None:
>       self.assertTrue(index.major_version == 1)
E       AssertionError: False is not true

/build/python-rtree-1.2.0/.pybuild/cpython3_3.11_rtree/build/tests/test_index.py:47: AssertionError
=========================== short test summary info ============================
FAILED tests/test_index.py::IndexVersion::test_libsidx_version - AssertionErr...
=================== 1 failed, 38 passed, 1 xfailed in 0.31s ====================
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
E: pybuild pybuild:389: test: plugin pyproject failed with: exit code=1: cd /build/python-rtree-1.2.0/.pybuild/cpython3_3.11_rtree/build; python3.11 -m pytest tests

This patch may suffice:

--- a/tests/test_index.py
+++ b/tests/test_index.py
@@ -44,8 +44,8 @@ class IndexTestCase(unittest.TestCase):

 class IndexVersion(unittest.TestCase):
     def test_libsidx_version(self) -> None:
-        self.assertTrue(index.major_version == 1)
-        self.assertTrue(index.minor_version >= 7)
+        self.assertTrue(index.major_version in [1, 2])
+        self.assertTrue((index.major_version == 1 and index.minor_version >= 7) or index.major_version > 1)

 class IndexCount(unittest.TestCase):
hobu commented 5 months ago

Thanks for the patch!

I suppose we should just relax the version test or remote it entirely. It doesn't add too much at this point

Lost pointers: 0

Are you purposely building in Debug mode or is it accidentally being enabled?

hobu commented 5 months ago

Answering my own question, NDEBUG is being set by CMake regardless of build type. I will fix with a new beta of libspatialindex.

hobu commented 5 months ago

https://github.com/libspatialindex/libspatialindex/pull/246 addressed the extra debug noise here

adamjstewart commented 5 months ago

This patch may suffice:

FWIW, it would be easier to write this as:

self.assertTrue((index.major_version, index.minor_version) >= (1, 7))

and it would work for version 3 too. But removing the test makes more sense in this case.

hobu commented 5 months ago

New libspatialindex beta available related to this https://github.com/libspatialindex/libspatialindex/releases/tag/2.0.0b2

sebastic commented 5 months ago

No change with respect to the "Lost pointers" output with b2:

I: pybuild base:311: cd /build/python-rtree-1.2.0/.pybuild/cpython3_3.12_rtree/build; python3.12 -m pytest tests
============================= test session starts ==============================
platform linux -- Python 3.12.3, pytest-8.2.1, pluggy-1.5.0
rootdir: /build/python-rtree-1.2.0/.pybuild/cpython3_3.12_rtree/build
configfile: pyproject.toml
collected 39 items

tests/test_finder.py ..                                                  [  5%]
tests/test_index.py .......x...........Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
.................                 [ 97%]
tests/test_tpr.py .                                                      [100%]

======================== 38 passed, 1 xfailed in 0.28s =========================
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
I: pybuild base:311: cd /build/python-rtree-1.2.0/.pybuild/cpython3_3.11_rtree/build; python3.11 -m pytest tests
============================= test session starts ==============================
platform linux -- Python 3.11.9, pytest-8.2.1, pluggy-1.5.0
rootdir: /build/python-rtree-1.2.0/.pybuild/cpython3_3.11_rtree/build
configfile: pyproject.toml
collected 39 items

tests/test_finder.py ..                                                  [  5%]
tests/test_index.py .......x...........Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
.................                 [ 97%]
tests/test_tpr.py .                                                      [100%]

======================== 38 passed, 1 xfailed in 0.30s =========================
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
Lost pointers: 0
hobu commented 5 months ago

No change with respect to the "Lost pointers" output with b2:

Hmph. Can you point me to where libspatialindex is being configured? I believe I had b2 set up so that if any Debug (RelWithDebInfo/Debug) is set as the CMAKE_BUILD_TYPE, it will output that stuff.

Maybe it isn't worth the trouble at all I we should just drop it. Modern analysis tools can tell you all that stuff easily...

sebastic commented 5 months ago

The package builds on the Debian infrastructure haven't started yet at time of writing, this is my local build log:

spatialindex.log

Note the use of -DCMAKE_BUILD_TYPE=None which allows the use of the buildflags set in the environment by dpkg-buildflags.

hobu commented 5 months ago

New release should take care of this https://github.com/libspatialindex/libspatialindex/releases/tag/2.0.0b3