Skip to content

Commit 45a8441

Browse files
committed
[processing] show error message instead of Python error if output raster is temp output and test can not be created
1 parent 17010ac commit 45a8441

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

python/plugins/processing/gui/TestTools.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
from numpy import nan_to_num
3838

3939
from qgis.PyQt.QtCore import QCoreApplication, QMetaObject
40-
from qgis.PyQt.QtWidgets import QDialog, QVBoxLayout, QTextEdit
40+
from qgis.PyQt.QtWidgets import QDialog, QVBoxLayout, QTextEdit, QMessageBox
4141

4242
from processing.core.Processing import Processing
4343
from processing.core.outputs import (
@@ -232,6 +232,15 @@ def createTest(text):
232232
if isinstance(out, (OutputNumber, OutputString)):
233233
results[out.name] = str(out)
234234
elif isinstance(out, OutputRaster):
235+
if token is None:
236+
QMessageBox.warning(None,
237+
tr('Error'),
238+
tr('Seems some outputs are temporary '
239+
'files. To create test you need to '
240+
'redirect all algorithm outputs to '
241+
'files'))
242+
return
243+
235244
dataset = gdal.Open(token, GA_ReadOnly)
236245
dataArray = nan_to_num(dataset.ReadAsArray(0))
237246
strhash = hashlib.sha224(dataArray.data).hexdigest()

0 commit comments

Comments
 (0)