From b304aeb31bb27e73a557821c4466bd562139e8ec Mon Sep 17 00:00:00 2001 From: uclaros Date: Wed, 10 Jul 2024 14:39:27 +0300 Subject: [PATCH] use temporary auth db for test --- .../python/test_processing_algs_gdal_gdalutils.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/src/python/test_processing_algs_gdal_gdalutils.py b/tests/src/python/test_processing_algs_gdal_gdalutils.py index b4569b0f60ec..ded8357ff8bc 100644 --- a/tests/src/python/test_processing_algs_gdal_gdalutils.py +++ b/tests/src/python/test_processing_algs_gdal_gdalutils.py @@ -10,6 +10,10 @@ __copyright__ = 'Copyright 2024, The QGIS Project' +import os +import tempfile +from shutil import rmtree + import unittest from qgis.testing import start_app, QgisTestCase from qgis.core import QgsApplication, QgsRasterLayer, QgsDataSourceUri, QgsAuthMethodConfig @@ -18,11 +22,21 @@ GdalConnectionDetails ) +QGIS_AUTH_DB_DIR_PATH = tempfile.mkdtemp() +os.environ['QGIS_AUTH_DB_DIR_PATH'] = QGIS_AUTH_DB_DIR_PATH + start_app() class TestProcessingAlgsGdalGdalUtils(QgisTestCase): + @classmethod + def tearDownClass(cls): + """Run after all tests""" + rmtree(QGIS_AUTH_DB_DIR_PATH) + del os.environ['QGIS_AUTH_DB_DIR_PATH'] + super().tearDownClass() + def test_gdal_connection_details_from_layer_postgresraster(self): """ Test GdalUtils.gdal_connection_details_from_layer