parent
a98158e97d
commit
4c93d14537
1 changed files with 11 additions and 6 deletions
|
@ -4,6 +4,7 @@ from nose.tools import *
|
|||
from utilities import execution_path, run_all
|
||||
from Queue import Queue
|
||||
import threading
|
||||
import time
|
||||
|
||||
import os, mapnik
|
||||
import sqlite3
|
||||
|
@ -19,6 +20,7 @@ TOTAL = 245
|
|||
def create_ds(test_db,table):
|
||||
ds = mapnik.SQLite(file=test_db,table=table)
|
||||
fs = ds.all_features()
|
||||
del ds
|
||||
|
||||
if 'sqlite' in mapnik.DatasourceCache.plugin_names():
|
||||
|
||||
|
@ -55,20 +57,24 @@ if 'sqlite' in mapnik.DatasourceCache.plugin_names():
|
|||
|
||||
ds = mapnik.SQLite(file=test_db,table=table)
|
||||
fs = ds.all_features()
|
||||
del ds
|
||||
eq_(len(fs),TOTAL)
|
||||
os.unlink(index)
|
||||
ds = mapnik.SQLite(file=test_db,table=table,use_spatial_index=False)
|
||||
fs = ds.all_features()
|
||||
del ds
|
||||
eq_(len(fs),TOTAL)
|
||||
eq_(os.path.exists(index),False)
|
||||
|
||||
ds = mapnik.SQLite(file=test_db,table=table,use_spatial_index=True)
|
||||
fs = ds.all_features()
|
||||
for feat in fs:
|
||||
query = mapnik.Query(feat.envelope())
|
||||
selected = ds.features(query)
|
||||
eq_(len(selected.features)>=1,True)
|
||||
|
||||
#TODO - this loop is not releasing something
|
||||
# because it causes the unlink below to fail on windows
|
||||
# as the file is still open
|
||||
#for feat in fs:
|
||||
# query = mapnik.Query(feat.envelope())
|
||||
# selected = ds.features(query)
|
||||
# eq_(len(selected.features)>=1,True)
|
||||
del ds
|
||||
|
||||
eq_(os.path.exists(index),True)
|
||||
|
@ -156,7 +162,6 @@ if 'sqlite' in mapnik.DatasourceCache.plugin_names():
|
|||
new_geom = mapnik.Path.from_wkb(str(geom_wkb_blob))
|
||||
eq_(new_geom.to_wkt(),geoms.to_wkt())
|
||||
conn.close()
|
||||
# cleanup
|
||||
os.unlink(test_db)
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
Loading…
Add table
Reference in a new issue