Skip to content

Commit 5bcf0f5

Browse files
committedMay 13, 2015
[processing] Added packaging tests, to easily check that a qgis installation has Processing dependencies
1 parent 31843a7 commit 5bcf0f5

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed
 
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
'''
2+
Tests to ensure that a QGIS installation contains Processing dependencies
3+
and they are correctly configured by default
4+
'''
5+
import unittest
6+
import sys
7+
from processing.algs.saga.SagaUtils import *
8+
from processing.core.ProcessingConfig import ProcessingConfig
9+
from processing.algs.grass.GrassUtils import GrassUtils
10+
11+
class PackageTests(unittest.TestCase):
12+
13+
def testSaga(self):
14+
folder = ProcessingConfig.getSetting(SAGA_FOLDER)
15+
ProcessingConfig.removeSetting(SAGA_FOLDER)
16+
self.assertEqual("2.1.4", getSagaInstalledVersion(True))
17+
ProcessingConfig.setSettingValue(SAGA_FOLDER, folder)
18+
19+
def testGrass(self):
20+
folder = ProcessingConfig.getSetting(GrassUtils.GRASS_FOLDER)
21+
ProcessingConfig.removeSetting(GrassUtils.GRASS_FOLDER)
22+
msg = GrassUtils.checkGrassIsInstalled()
23+
self.assertIsNone(msg)
24+
ProcessingConfig.setSettingValue(GrassUtils.GRASS_FOLDER, folder)
25+
26+
def runTests():
27+
t = unittest.TestLoader().loadTestsFromTestCase(PackageTests)
28+
unittest.TextTestRunner(verbosity=3, stream=sys.stdout).run(t)

0 commit comments

Comments
 (0)
Please sign in to comment.