-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Done] Upgrade spatialite file version to version 4 (#180)
- Loading branch information
Showing
16 changed files
with
253 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
** | ||
!requirements*.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,8 +10,6 @@ services: | |
volumes: | ||
- .:/code | ||
working_dir: /code | ||
depends_on: | ||
- postgis | ||
command: bash | ||
|
||
postgis: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
coverage | ||
factory_boy | ||
flake8 | ||
pytest | ||
pytest-cov | ||
pytest-flake8 | ||
mock | ||
mypy | ||
sqlalchemy-stubs | ||
pytest-cov | ||
threedi-api-client | ||
aiofiles | ||
aiohttp | ||
pytest-asyncio | ||
numpy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
GeoAlchemy2==0.6.1 | ||
SQLAlchemy==1.3.1 | ||
Click | ||
GeoAlchemy2>=0.9,!=0.11.* | ||
SQLAlchemy>=1.2 | ||
Click==7.0 | ||
psycopg2 | ||
alembic | ||
alembic>=0.9 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
from geoalchemy2 import func as geo_func | ||
from threedi_modelchecker.spatialite_versions import get_spatialite_version, copy_model | ||
from threedi_modelchecker.threedi_model import models | ||
|
||
|
||
def test_get_spatialite_version(empty_sqlite_v3): | ||
lib_version, file_version = get_spatialite_version(empty_sqlite_v3) | ||
assert lib_version in (3, 4, 5) | ||
assert file_version == 3 | ||
|
||
|
||
def test_copy_model(empty_sqlite_v3, empty_sqlite_v3_clone): | ||
obj = models.ConnectionNode( | ||
id=3, code="test", the_geom="SRID=4326;POINT(-71.064544 42.287870)" | ||
) | ||
with empty_sqlite_v3.session_scope() as session: | ||
session.add(obj) | ||
session.commit() | ||
|
||
copy_model(empty_sqlite_v3, empty_sqlite_v3_clone, models.ConnectionNode) | ||
|
||
assert models.ConnectionNode.__table__.columns | ||
|
||
with empty_sqlite_v3_clone.session_scope() as session: | ||
records = list( | ||
session.query( | ||
models.ConnectionNode.id, | ||
models.ConnectionNode.code, | ||
geo_func.ST_AsText(models.ConnectionNode.the_geom), | ||
models.ConnectionNode.the_geom_linestring, | ||
) | ||
) | ||
|
||
assert records == [(3, "test", "POINT(-71.064544 42.28787)", None)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.