Skip to content

Commit 798c8b8

Browse files
authored
Run with SpatiaLite in Circle CI - closes #4
Pull request #5
1 parent c1d93bc commit 798c8b8

File tree

3 files changed

+7
-43
lines changed

3 files changed

+7
-43
lines changed

.circleci/config.yml

Lines changed: 3 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,6 @@ workflows:
66
filters:
77
tags:
88
only: /.*/
9-
- test-python-install:
10-
version: "3.6"
11-
requires:
12-
- build
13-
- test-python-install:
14-
version: "3.7"
15-
requires:
16-
- build
179
- deploy:
1810
requires:
1911
- build
@@ -25,44 +17,16 @@ workflows:
2517
jobs:
2618
build:
2719
docker:
28-
- image: circleci/python:3.6
20+
- image: circleci/python:3.8
2921
steps:
3022
- checkout
3123
- restore_cache:
3224
key: v1-dependency-cache-{{ checksum "setup.py" }}
3325
- run:
34-
name: Installe mod_spatialite
26+
name: Install mod_spatialite
3527
command: |
3628
sudo apt-get update
37-
sudo apt-get install libsqlite3-mod-spatialite
38-
- run:
39-
name: install python dependencies
40-
command: |
41-
python3 -m venv venv
42-
. venv/bin/activate
43-
pip install -e .
44-
- save_cache:
45-
key: v1-dependency-cache-{{ checksum "setup.py" }}
46-
paths:
47-
- "venv"
48-
- run:
49-
name: run tests
50-
command: |
51-
. venv/bin/activate
52-
pip install -e .
53-
pip install pytest
54-
pytest
55-
test-python-install:
56-
parameters:
57-
version:
58-
type: string
59-
default: latest
60-
docker:
61-
- image: circleci/python:3.6
62-
steps:
63-
- checkout
64-
- restore_cache:
65-
key: v1-dependency-cache-{{ checksum "setup.py" }}
29+
sudo apt-get install -y libsqlite3-mod-spatialite
6630
- run:
6731
name: install python dependencies
6832
command: |

geojson_to_sqlite/utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def import_features(
2929
lib = spatialite_mod or find_spatialite()
3030
if not lib:
3131
raise SpatiaLiteError("Could not find SpatiaLite module")
32-
init_spatialite(db)
32+
init_spatialite(db, lib)
3333
ensure_table_has_geometry(db, table)
3434
conversions = {"geometry": "GeomFromText(?, 4326)"}
3535

@@ -58,9 +58,9 @@ def find_spatialite():
5858
return None
5959

6060

61-
def init_spatialite(db):
61+
def init_spatialite(db, lib):
6262
db.conn.enable_load_extension(True)
63-
db.conn.load_extension("/usr/local/lib/mod_spatialite.dylib")
63+
db.conn.load_extension(lib)
6464
# Initialize SpatiaLite if not yet initialized
6565
if "spatial_ref_sys_all" in db.table_names():
6666
return

tests/test_geojson_to_sqlite.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def test_single_feature_spatialite(tmpdir):
4646
)
4747
assert 0 == result.exit_code, result.stdout
4848
db = sqlite_utils.Database(db_path)
49-
utils.init_spatialite(db)
49+
utils.init_spatialite(db, utils.find_spatialite())
5050
assert {"features", "spatial_ref_sys"}.issubset(db.table_names())
5151
rows = db.execute_returning_dicts(
5252
"select slug, AsGeoJSON(geometry) as geometry from features"

0 commit comments

Comments
 (0)