forked from enthought/mayavi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_garbage_collection.py
60 lines (46 loc) · 1.78 KB
/
test_garbage_collection.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
""" Tests for the garbage collection of objects in tvtk package.
"""
# Authors: Deepak Surti, Ioannis Tziakos
# Copyright (c) 2015, Enthought, Inc.
# License: BSD Style.
import unittest
from traits.etsconfig.api import ETSConfig
from tvtk.pyface.tvtk_scene import TVTKScene
from tvtk.pyface.api import DecoratedScene, Scene
from tvtk.pyface.scene_model import SceneModel
from tvtk.tests.common import TestGarbageCollection
class TestTVTKGarbageCollection(TestGarbageCollection):
""" See: tvtk.tests.common.TestGarbageCollection
"""
def test_tvtk_scene(self):
""" Tests if TVTK scene can be garbage collected."""
def create_fn():
return TVTKScene()
def close_fn(o):
o.closing = True
self.check_object_garbage_collected(create_fn, close_fn)
@unittest.skipIf(
ETSConfig.toolkit=='wx', 'Test segfaults using WX (issue #216)')
def test_scene(self):
""" Tests if Scene can be garbage collected."""
def create_fn():
return Scene()
def close_fn(o):
o.close()
self.check_object_garbage_collected(create_fn, close_fn)
@unittest.skipIf(
ETSConfig.toolkit=='wx', 'Test segfaults using WX (issue #216)')
def test_decorated_scene(self):
""" Tests if Decorated Scene can be garbage collected."""
def create_fn():
return DecoratedScene(parent=None)
def close_fn(o):
o.closing = True
self.check_object_garbage_collected(create_fn, close_fn)
def test_scene_model(self):
""" Tests if SceneModel can be garbage collected."""
def create_fn():
return SceneModel()
def close_fn(o):
o.closing = True
self.check_object_garbage_collected(create_fn, close_fn)