Showing with 64 additions and 6 deletions.
  1. +1 −0 tests/src/python/CMakeLists.txt
  2. +60 −0 tests/src/python/test_qgsanalysis.py
  3. +3 −6 tests/src/python/test_qgscomposition.py
1 change: 1 addition & 0 deletions tests/src/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ ADD_PYTHON_TEST(PyQgsRectangle test_qgsrectangle.py)
ADD_PYTHON_TEST(PyQgsSpatialIndex test_qgsspatialindex.py)
ADD_PYTHON_TEST(PyQgsComposerHtml test_qgscomposerhtml.py)
ADD_PYTHON_TEST(PyQgsComposition test_qgscomposition.py)
ADD_PYTHON_TEST(PyQgsAnalysis test_qgsanalysis.py)
#ADD_PYTHON_TEST(PyQgsComposerMap test_qgscomposermap.py)
60 changes: 60 additions & 0 deletions tests/src/python/test_qgsanalysis.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# -*- coding: utf-8 -*-
'''
test_analysis.py
--------------------------------------
Date : September 2012
Copyright : (C) 2012 by Tim Sutton
email : tim@linfiniti.com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
'''
import unittest
import sys
import os
from utilities import unitTestDataPath, getQgisTestApp
from PyQt4.QtCore import QFileInfo, QDir, QStringList
from PyQt4.QtXml import QDomDocument

# support python < 2.7 via unittest2
# needed for expected failure decorator
if sys.version_info[0:2] < (2,7):
try:
from unittest2 import TestCase, expectedFailure
except ImportError:
print "You need to install unittest2 to run the salt tests"
sys.exit(1)
else:
from unittest import TestCase, expectedFailure

QGISAPP, CANVAS, IFACE, PARENT = getQgisTestApp()
TEST_DATA_DIR = unitTestDataPath()


class TestQgsZonalStatistics(TestCase):

def setUp(self):
"""Run before each test."""
pass

def tearDown(self):
"""Run after each test."""
pass

@expectedFailure
def testSubstitutionMap(self):
"""Test that we can import zonal statistics was failing as of d5f6543
"""
try:
from qgis.analysis import QgsZonalStatistics
except ImportError:
self.fail('Failed to import zonal statistics python module')


if __name__ == '__main__':
unittest.main()
9 changes: 3 additions & 6 deletions tests/src/python/test_qgscomposition.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@
'''
test_qgscomposerhtml.py
--------------------------------------
Date : August 2012
Copyright : (C) 2012 by Dr. Horst Düster /
Dr. Marco Hugentobler
Tim Sutton
email : marco@sourcepole.ch
Date : September 2012
Copyright : (C) 2012 by Tim Sutton
email : tim@linfiniti.com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
Expand Down Expand Up @@ -119,7 +117,6 @@ def testPrintMapFromTemplate(self):
myMapRenderer.setLayerSet(myLayerStringList)
myMapRenderer.setProjectionsEnabled(False)


myComposition = QgsComposition(myMapRenderer)
myFile = os.path.join(TEST_DATA_DIR, 'template-for-substitution.qpt')
myTemplateFile = file(myFile, 'rt')
Expand Down