From 18fbbdad731c173ef10bdc7aa5d2547b3909fc36 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 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pytest_qgis/pytest_qgis.py b/src/pytest_qgis/pytest_qgis.py index 4f336e0..f532bc3 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,8 @@ def qgis_app(request: "SubRequest") -> QgsApplication: _CANVAS.deleteLater() _APP.exitQgis() if _QGIS_CONFIG_PATH and _QGIS_CONFIG_PATH.exists(): - shutil.rmtree(_QGIS_CONFIG_PATH) + with contextlib.suppress(PermissionError): + shutil.rmtree(_QGIS_CONFIG_PATH) @pytest.fixture(scope="session")