Skip to content
Permalink
Browse files

Use mkdtemp for temporary directory and clean at the end of the test

  • Loading branch information
troopa81 committed Jan 11, 2019
1 parent 99076c9 commit 8efc68984fe2c3d1277bfb748edf3b1ebaf1a106
Showing with 4 additions and 3 deletions.
  1. +4 −3 tests/src/python/test_provider_spatialite.py
@@ -757,9 +757,7 @@ def testDecodeUri(self):
def testPKNotInt(self):
""" Check when primary key is not an integer """
# create test db
dbname = os.path.join(tempfile.gettempdir(), "test_pknotint.sqlite")
if os.path.exists(dbname):
os.remove(dbname)
dbname = os.path.join(tempfile.mkdtemp(), "test_pknotint.sqlite")
con = spatialite_connect(dbname, isolation_level=None)
cur = con.cursor()

@@ -805,6 +803,9 @@ def testPKNotInt(self):

con.close()

basepath, filename = os.path.split(dbname)
shutil.rmtree(basepath)

def testLoadStyle(self):
"""Check that we can store and load a style"""

0 comments on commit 8efc689

Please sign in to comment.
You can’t perform that action at this time.