From 4a4cfec24989ce9d82ee46c957241057558d7003 Mon Sep 17 00:00:00 2001 From: Joonalai Date: Mon, 26 Jun 2023 08:14:50 +0300 Subject: [PATCH] fix: suppress errors when deleting temp dir [#41] --- src/pytest_qgis/pytest_qgis.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/pytest_qgis/pytest_qgis.py b/src/pytest_qgis/pytest_qgis.py index 4f336e0..461f61f 100644 --- a/src/pytest_qgis/pytest_qgis.py +++ b/src/pytest_qgis/pytest_qgis.py @@ -18,7 +18,7 @@ # You should have received a copy of the GNU General Public License # along with pytest-qgis. If not, see . - +import contextlib import os.path import shutil import sys @@ -155,7 +155,9 @@ def qgis_app(request: "SubRequest") -> QgsApplication: _CANVAS.deleteLater() _APP.exitQgis() if _QGIS_CONFIG_PATH and _QGIS_CONFIG_PATH.exists(): - shutil.rmtree(_QGIS_CONFIG_PATH) + # TODO: https://github.com/GispoCoding/pytest-qgis/issues/43 + with contextlib.suppress(PermissionError): + shutil.rmtree(_QGIS_CONFIG_PATH) @pytest.fixture(scope="session")