diff --git a/python/testing/__init__.py b/python/testing/__init__.py index 05b769c4962c..cf4f34c38e48 100644 --- a/python/testing/__init__.py +++ b/python/testing/__init__.py @@ -552,7 +552,9 @@ def start_app(cleanup=True): # no need to mess with it here. QGISAPP = QgsApplication(argvb, myGuiFlag) - os.environ['QGIS_CUSTOM_CONFIG_PATH'] = tempfile.mkdtemp('', 'QGIS-PythonTestConfigPath') + tmpdir = tempfile.mkdtemp('', 'QGIS-PythonTestConfigPath-') + os.environ['QGIS_CUSTOM_CONFIG_PATH'] = tmpdir + QGISAPP.initQgis() print(QGISAPP.showSettings()) @@ -563,10 +565,12 @@ def debug_log_message(message, tag, level): if cleanup: import atexit + import shutil @atexit.register def exitQgis(): QGISAPP.exitQgis() + shutil.rmtree(tmpdir) return QGISAPP