Skip to content

Commit 39db80a

Browse files
committed
Support older version of python for expectedfail in rect tests
1 parent bbf0c08 commit 39db80a

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

tests/src/python/test_qgsrectangle.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,25 @@
55
QgsPoint)
66

77
from utilities import getQgisTestApp
8+
import sys
9+
10+
# support python < 2.7 via unittest2
11+
# needed for expected failure decorator
12+
if sys.version_info[0:2] < (2,7):
13+
try:
14+
from unittest2 import TestCase, expectedFailure
15+
except ImportError:
16+
print "You need to install unittest2 to run the salt tests"
17+
sys.exit(1)
18+
else:
19+
from unittest import TestCase, expectedFailure
20+
821
QGISAPP, CANVAS, IFACE, PARENT = getQgisTestApp()
922

10-
class TestQgsRectangle(unittest.TestCase):
23+
class TestQgsRectangle(TestCase):
1124

1225
# Because isEmpty() is not returning expected result in 9b0fee3
13-
@unittest.expectedFailure
26+
@expectedFailure
1427
def testCtor(self):
1528
rect = QgsRectangle(5.0, 5.0, 10.0, 10.0)
1629

0 commit comments

Comments
 (0)