summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Feltman <sfeltman@src.gnome.org>2014-03-03 04:39:35 -0800
committerSimon Feltman <sfeltman@src.gnome.org>2014-03-03 04:39:35 -0800
commit038563ed620e0d966e385a1779455d9b0e148c41 (patch)
tree97707362e5df10b38d3ed1b1caf56e6244e5cad5
parent1fa93ddc51b2d223d772aee7930fc96c0ced0e00 (diff)
downloadpygobject-038563ed620e0d966e385a1779455d9b0e148c41.tar.gz
tests: Conditionalize usage of regress typelib in test_properties
Unconditional usage of regress breaks tests when PyGObject is built without cairo.
-rw-r--r--tests/test_properties.py27
1 files changed, 17 insertions, 10 deletions
diff --git a/tests/test_properties.py b/tests/test_properties.py
index d7ceb894..c0579f74 100644
--- a/tests/test_properties.py
+++ b/tests/test_properties.py
@@ -21,10 +21,15 @@ from gi.repository.GObject import \
from gi.repository import Gio
from gi.repository import GLib
-from gi.repository import Regress
from gi.repository import GIMarshallingTests
from gi import _propertyhelper as propertyhelper
+try:
+ from gi.repository import Regress
+ has_regress = True
+except ImportError:
+ has_regress = False
+
if sys.version_info < (3, 0):
TEST_UTF8 = "\xe2\x99\xa5"
UNICODE_UTF8 = unicode(TEST_UTF8, 'UTF-8')
@@ -73,19 +78,20 @@ class PropertyObject(GObject.GObject):
type=Gio.File, flags=PARAM_READWRITE | PARAM_CONSTRUCT)
-class PropertyInheritanceObject(Regress.TestObj):
- # override property from the base class, with a different type
- string = GObject.Property(type=int)
-
- # a property entirely defined at the Python level
- python_prop = GObject.Property(type=str)
+if has_regress:
+ class PropertyInheritanceObject(Regress.TestObj):
+ # override property from the base class, with a different type
+ string = GObject.Property(type=int)
+ # a property entirely defined at the Python level
+ python_prop = GObject.Property(type=str)
-class PropertySubClassObject(PropertyInheritanceObject):
- # override property from the base class, with a different type
- python_prop = GObject.Property(type=int)
+ class PropertySubClassObject(PropertyInheritanceObject):
+ # override property from the base class, with a different type
+ python_prop = GObject.Property(type=int)
+@unittest.skipUnless(has_regress, 'Missing Regress typelib')
class TestPropertyInheritanceObject(unittest.TestCase):
def test_override_gi_property(self):
self.assertNotEqual(Regress.TestObj.props.string.value_type,
@@ -728,6 +734,7 @@ class TestProperty(unittest.TestCase):
b.prop1 = 20
self.assertEqual(b.prop1, 20)
+ @unittest.skipUnless(has_regress, 'Missing regress typelib')
def test_property_subclass_c(self):
class A(Regress.TestSubObj):
prop1 = GObject.Property(type=int)