Skip to content

Commit

Permalink
Use mkdtemp for temporary directory and clean at the end of the test
Browse files Browse the repository at this point in the history
  • Loading branch information
troopa81 committed Jan 11, 2019
1 parent 99076c9 commit 8efc689
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tests/src/python/test_provider_spatialite.py
Expand Up @@ -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()

Expand Down Expand Up @@ -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"""

Expand Down

0 comments on commit 8efc689

Please sign in to comment.