Skip to content

Commit

Permalink
Merge pull request #107 from avalentino/feature/i386-compat
Browse files Browse the repository at this point in the history
Fix compatibility with i386
  • Loading branch information
constantinius authored Dec 30, 2024
2 parents bde7dda + e4e13d5 commit cbf900c
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions tests/backends/sqlalchemy/test_evaluate.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,18 @@

Base = declarative_base()

mod_spatialite = ctypes.util.find_library("mod_spatialite")
if not mod_spatialite:
import pathlib
matches = list(pathlib.Path("/usr/lib").glob("*/mod_spatialite.so"))
if matches:
mod_spatialite = str(matches[0])

import pytest
pytestmark = pytest.mark.skipif(
not mod_spatialite, reason="mod_spatialite.so not available"
)


class Record(Base):
__tablename__ = "record"
Expand Down Expand Up @@ -70,10 +82,7 @@ class RecordMeta(Base):

def load_spatialite(dbapi_conn, connection_record):
dbapi_conn.enable_load_extension(True)
dbapi_conn.load_extension(
ctypes.util.find_library("mod_spatialite")
or "/usr/lib/x86_64-linux-gnu/mod_spatialite.so"
)
dbapi_conn.load_extension(mod_spatialite)


@pytest.fixture(scope="session")
Expand Down

0 comments on commit cbf900c

Please sign in to comment.