Skip to content
Permalink
Browse files

Added simple python vector layer test

  • Loading branch information
timlinux committed Sep 7, 2012
1 parent 85b4a36 commit 2e8d82fd3e6cbd6ceb0b43f14cd1196b87d5016c
Showing with 25 additions and 0 deletions.
  1. +1 −0 tests/src/python/CMakeLists.txt
  2. +24 −0 tests/src/python/test_qgsvectorlayer.py
@@ -3,6 +3,7 @@ ADD_PYTHON_TEST(PyQGisApp test_qgisapp.py)
ADD_PYTHON_TEST(PyQgsComposerHtml test_qgscomposerhtml.py)
ADD_PYTHON_TEST(PyQgsComposerMap test_qgscomposermap.py)
ADD_PYTHON_TEST(PyQgsGeometry test_qgsgeometry.py)
ADD_PYTHON_TEST(PyQgsVectorLayer test_qgsvectorlayer.py)
ADD_PYTHON_TEST(PyQgsRasterLayer test_qgsrasterlayer.py)
ADD_PYTHON_TEST(PyQgsRasterFileWriter test_qgsrasterfilewriter.py)
ADD_PYTHON_TEST(PyQgsMemoryProvider test_qgsmemoryprovider.py)
@@ -0,0 +1,24 @@
import os
import unittest

from PyQt4.QtCore import QDir

from qgis.core import QgsVectorLayer
from utilities import getQgisTestApp, unitTestDataPath

QGISAPP, CANVAS, IFACE, PARENT = getQgisTestApp()


class TestQgsVectorLayer(unittest.TestCase):

def test_FeatureCount(self):
myPath = os.path.join(unitTestDataPath(), 'lines.shp')
myLayer = QgsVectorLayer(myPath, 'Lines', 'ogr')
myCount = myLayer.featureCount()
myExpectedCount = 6
myMessage = '\nExpected: %s\nGot: %s' % (myCount, myExpectedCount)
assert myCount == myExpectedCount, myMessage

if __name__ == '__main__':
unittest.main()

0 comments on commit 2e8d82f

Please sign in to comment.
You can’t perform that action at this time.